All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH RFC] SUNRPC: Backchannel RPCs don't fail when the transport disconnects
Date: Fri, 03 Apr 2020 15:42:10 -0400	[thread overview]
Message-ID: <20200403193802.2887.41182.stgit@klimt.1015granger.net> (raw)

Commit 3832591e6fa5 ("SUNRPC: Handle connection issues correctly on
the back channel") intended to make backchannel RPCs fail
immediately when there is no forward channel connection. What's
currently happening is, when the forward channel conneciton goes
away, backchannel operations are causing hard loops because
call_transmit_status's SOFTCONN logic ignores ENOTCONN.

To avoid changing the behavior of call_transmit_status in the
forward direction, make backchannel RPCs return with a different
error than ENOTCONN when they fail.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 net/sunrpc/xprtrdma/svc_rdma_backchannel.c |   15 ++++++++++-----
 net/sunrpc/xprtsock.c                      |    6 ++++--
 2 files changed, 14 insertions(+), 7 deletions(-)

I'm playing with this fix. It seems to be required in order to get
Kerberos mounts to work under load with NFSv4.1 and later on RDMA.

If there are no objections, I can carry this for v5.7-rc ...


diff --git a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
index d510a3a15d4b..b8a72d7fbcc2 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
@@ -207,11 +207,16 @@ rpcrdma_bc_send_request(struct svcxprt_rdma *rdma, struct rpc_rqst *rqst)
 
 drop_connection:
 	dprintk("svcrdma: failed to send bc call\n");
-	return -ENOTCONN;
+	return -EHOSTUNREACH;
 }
 
-/* Send an RPC call on the passive end of a transport
- * connection.
+/**
+ * xprt_rdma_bc_send_request - send an RPC backchannel Call
+ * @rqst: RPC Call in rq_snd_buf
+ *
+ * Returns:
+ *	%0 if the RPC message has been sent
+ *	%-EHOSTUNREACH if the Call could not be sent
  */
 static int
 xprt_rdma_bc_send_request(struct rpc_rqst *rqst)
@@ -225,11 +230,11 @@ xprt_rdma_bc_send_request(struct rpc_rqst *rqst)
 
 	mutex_lock(&sxprt->xpt_mutex);
 
-	ret = -ENOTCONN;
+	ret = -EHOSTUNREACH;
 	rdma = container_of(sxprt, struct svcxprt_rdma, sc_xprt);
 	if (!test_bit(XPT_DEAD, &sxprt->xpt_flags)) {
 		ret = rpcrdma_bc_send_request(rdma, rqst);
-		if (ret == -ENOTCONN)
+		if (ret < 0)
 			svc_close_xprt(sxprt);
 	}
 
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 17cb902e5153..92a358fd2ff0 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -2543,7 +2543,9 @@ static int bc_sendto(struct rpc_rqst *req)
 	req->rq_xtime = ktime_get();
 	err = xprt_sock_sendmsg(transport->sock, &msg, xdr, 0, marker, &sent);
 	xdr_free_bvec(xdr);
-	if (err < 0 || sent != (xdr->len + sizeof(marker)))
+	if (err < 0)
+		return -EHOSTUNREACH;
+	if (sent != (xdr->len + sizeof(marker)))
 		return -EAGAIN;
 	return sent;
 }
@@ -2567,7 +2569,7 @@ static int bc_send_request(struct rpc_rqst *req)
 	 */
 	mutex_lock(&xprt->xpt_mutex);
 	if (test_bit(XPT_DEAD, &xprt->xpt_flags))
-		len = -ENOTCONN;
+		len = -EHOSTUNREACH;
 	else
 		len = bc_sendto(req);
 	mutex_unlock(&xprt->xpt_mutex);


             reply	other threads:[~2020-04-03 19:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03 19:42 Chuck Lever [this message]
2020-04-03 20:00 ` [PATCH RFC] SUNRPC: Backchannel RPCs don't fail when the transport disconnects Trond Myklebust
2020-04-03 20:05   ` Chuck Lever
2020-04-03 21:46     ` Chuck Lever
2020-04-03 22:43       ` Trond Myklebust
2020-04-03 23:11         ` Chuck Lever
2020-04-06 20:10           ` Bruce Fields
2020-04-07 14:04           ` Chuck Lever

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200403193802.2887.41182.stgit@klimt.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.