Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

SUNRPC: Add RPC task and client level options to disable the resend timeout

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

+19 -4
+2
include/linux/sunrpc/clnt.h
··· 49 49 50 50 unsigned int cl_softrtry : 1,/* soft timeouts */ 51 51 cl_discrtry : 1,/* disconnect before retry */ 52 + cl_noretranstimeo: 1,/* No retransmit timeouts */ 52 53 cl_autobind : 1,/* use getport() */ 53 54 cl_chatty : 1;/* be verbose */ 54 55 ··· 127 126 #define RPC_CLNT_CREATE_QUIET (1UL << 6) 128 127 #define RPC_CLNT_CREATE_INFINITE_SLOTS (1UL << 7) 129 128 #define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 8) 129 + #define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9) 130 130 131 131 struct rpc_clnt *rpc_create(struct rpc_create_args *args); 132 132 struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
+1
include/linux/sunrpc/sched.h
··· 122 122 #define RPC_TASK_SENT 0x0800 /* message was sent */ 123 123 #define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */ 124 124 #define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */ 125 + #define RPC_TASK_NO_RETRANS_TIMEOUT 0x4000 /* wait forever for a reply */ 125 126 126 127 #define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) 127 128 #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
+4 -1
net/sunrpc/clnt.c
··· 772 772 atomic_inc(&clnt->cl_count); 773 773 if (clnt->cl_softrtry) 774 774 task->tk_flags |= RPC_TASK_SOFT; 775 + if (clnt->cl_noretranstimeo) 776 + task->tk_flags |= RPC_TASK_NO_RETRANS_TIMEOUT; 775 777 if (sk_memalloc_socks()) { 776 778 struct rpc_xprt *xprt; 777 779 ··· 1900 1898 rpc_delay(task, 3*HZ); 1901 1899 case -ETIMEDOUT: 1902 1900 task->tk_action = call_timeout; 1903 - if (task->tk_client->cl_discrtry) 1901 + if (!(task->tk_flags & RPC_TASK_NO_RETRANS_TIMEOUT) 1902 + && task->tk_client->cl_discrtry) 1904 1903 xprt_conditional_disconnect(req->rq_xprt, 1905 1904 req->rq_connect_cookie); 1906 1905 break;
+12 -3
net/sunrpc/xprt.c
··· 873 873 dprintk("RPC: %5u xprt_prepare_transmit\n", task->tk_pid); 874 874 875 875 spin_lock_bh(&xprt->transport_lock); 876 - if (req->rq_reply_bytes_recvd && !req->rq_bytes_sent) { 877 - task->tk_status = req->rq_reply_bytes_recvd; 878 - goto out_unlock; 876 + if (!req->rq_bytes_sent) { 877 + if (req->rq_reply_bytes_recvd) { 878 + task->tk_status = req->rq_reply_bytes_recvd; 879 + goto out_unlock; 880 + } 881 + if ((task->tk_flags & RPC_TASK_NO_RETRANS_TIMEOUT) 882 + && xprt_connected(xprt) 883 + && req->rq_connect_cookie == xprt->connect_cookie) { 884 + xprt->ops->set_retrans_timeout(task); 885 + rpc_sleep_on(&xprt->pending, task, xprt_timer); 886 + goto out_unlock; 887 + } 879 888 } 880 889 if (!xprt->ops->reserve_xprt(xprt, task)) { 881 890 task->tk_status = -EAGAIN;