From: Vallish Vaidyeshwara <vallish@amazon.com>
To: <trond.myklebust@primarydata.com>, <anna.schumaker@netapp.com>,
<jlayton@kernel.org>, <bfields@fieldses.org>,
<linux-nfs@vger.kernel.org>
Cc: <jsstraus@amazon.com>
Subject: [PATCH 2/2] SUNRPC: Reconnect with new port on server initiated connection termination
Date: Thu, 10 May 2018 06:12:54 +0000 [thread overview]
Message-ID: <1525932774-98736-3-git-send-email-vallish@amazon.com> (raw)
In-Reply-To: <1525932774-98736-1-git-send-email-vallish@amazon.com>
Server initiated socket close can corrupt connection state tracking
table in conjunction with other network middle boxes. In situations
like these, client connection hangs till connection state tracking
table entries age out and get purged. Client reconnection with a new
port in such a situation will avoid connection hang.
Reviewed-by: Jacob Strauss <jsstraus@amazon.com>
Reviewed-by: Alakesh Haloi <alakeshh@amazon.com>
Signed-off-by: Vallish Vaidyeshwara <vallish@amazon.com>
---
net/sunrpc/xprtsock.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 5bf75b3..d293c8d 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1629,6 +1629,8 @@ static void xs_tcp_state_change(struct sock *sk)
/* The server initiated a shutdown of the socket */
xprt->connect_cookie++;
clear_bit(XPRT_CONNECTED, &xprt->state);
+ /* Server sent FIN, reconnect with a new port */
+ transport->srcport = 0;
xs_tcp_force_close(xprt);
/* fall through */
case TCP_CLOSING:
@@ -1650,6 +1652,9 @@ static void xs_tcp_state_change(struct sock *sk)
&transport->sock_state))
xprt_clear_connecting(xprt);
clear_bit(XPRT_CLOSING, &xprt->state);
+ /* Server sent RST, reconnect with a new port */
+ if (sk->sk_err == ECONNRESET)
+ transport->srcport = 0;
if (sk->sk_err)
xprt_wake_pending_tasks(xprt, -sk->sk_err);
/* Trigger the socket release */
--
2.7.3.AMZN
next prev parent reply other threads:[~2018-05-10 6:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-10 6:12 [PATCH 0/2] SUNRPC: Clean up port reuse behavior on reconnects Vallish Vaidyeshwara
2018-05-10 6:12 ` [PATCH 1/2] SUNRPC: Need to reuse non-reserved port for reconnect Vallish Vaidyeshwara
2018-05-10 21:18 ` Vallish Vaidyeshwara
2018-05-10 6:12 ` Vallish Vaidyeshwara [this message]
2018-05-10 15:25 ` [PATCH 2/2] SUNRPC: Reconnect with new port on server initiated connection termination Trond Myklebust
2018-05-10 16:22 ` Vallish Vaidyeshwara
2018-05-10 17:26 ` Trond Myklebust
2018-05-10 21:12 ` Vallish Vaidyeshwara
2018-05-10 17:37 ` bfields
2018-05-10 21:15 ` Vallish Vaidyeshwara
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=1525932774-98736-3-git-send-email-vallish@amazon.com \
--to=vallish@amazon.com \
--cc=anna.schumaker@netapp.com \
--cc=bfields@fieldses.org \
--cc=jlayton@kernel.org \
--cc=jsstraus@amazon.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@primarydata.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).