SUNRPC: Don't start the retransmission timer when out of socket space
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 22 Feb 2013 19:57:57 +0000 (14:57 -0500)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 22 Feb 2013 20:17:17 +0000 (15:17 -0500)
If the socket is full, we're better off just waiting until it empties,
or until the connection is broken. The reason why we generally don't
want to time out is that the call to xprt->ops->release_xprt() will
trigger a connection reset, which isn't helpful...

Let's make an exception for soft RPC calls, since they have to provide
timeout guarantees.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: stable@vger.kernel.org
net/sunrpc/xprt.c

index 846c34fdee9f496c1e94ccbdcfe306eefe35d0d0..b7478d5e7ffde8ae06c3a02bb682aec69f339adc 100644 (file)
@@ -487,13 +487,17 @@ EXPORT_SYMBOL_GPL(xprt_wake_pending_tasks);
  * xprt_wait_for_buffer_space - wait for transport output buffer to clear
  * @task: task to be put to sleep
  * @action: function pointer to be executed after wait
+ *
+ * Note that we only set the timer for the case of RPC_IS_SOFT(), since
+ * we don't in general want to force a socket disconnection due to
+ * an incomplete RPC call transmission.
  */
 void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action)
 {
        struct rpc_rqst *req = task->tk_rqstp;
        struct rpc_xprt *xprt = req->rq_xprt;
 
-       task->tk_timeout = req->rq_timeout;
+       task->tk_timeout = RPC_IS_SOFT(task) ? req->rq_timeout : 0;
        rpc_sleep_on(&xprt->pending, task, action);
 }
 EXPORT_SYMBOL_GPL(xprt_wait_for_buffer_space);