diff mbox series

SUNRPC: Don't let RPC_SOFTCONN tasks time out if the transport is connected

Message ID 20190319171429.109726-1-trond.myklebust@hammerspace.com (mailing list archive)
State New, archived
Headers show
Series SUNRPC: Don't let RPC_SOFTCONN tasks time out if the transport is connected | expand

Commit Message

Trond Myklebust March 19, 2019, 5:14 p.m. UTC
If the transport is still connected, then we do want to allow
RPC_SOFTCONN tasks to retry. They should time out if and only if
the connection is broken.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 net/sunrpc/clnt.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 228970e6e52b..98f6e27feba5 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -2315,6 +2315,7 @@  static void
 rpc_check_timeout(struct rpc_task *task)
 {
 	struct rpc_clnt	*clnt = task->tk_client;
+	struct rpc_xprt *xprt = NULL;
 
 	if (xprt_adjust_timeout(task->tk_rqstp) == 0)
 		return;
@@ -2322,10 +2323,14 @@  rpc_check_timeout(struct rpc_task *task)
 	dprintk("RPC: %5u call_timeout (major)\n", task->tk_pid);
 	task->tk_timeouts++;
 
-	if (RPC_IS_SOFTCONN(task)) {
+	if (task->tk_rqstp)
+		xprt = task->tk_rqstp->rq_xprt;
+
+	if (RPC_IS_SOFTCONN(task) && xprt && !xprt_connected(xprt)) {
 		rpc_exit(task, -ETIMEDOUT);
 		return;
 	}
+
 	if (RPC_IS_SOFT(task)) {
 		if (clnt->cl_chatty) {
 			printk(KERN_NOTICE "%s: server %s not responding, timed out\n",