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: Re: [PATCH 1/2] SUNRPC: Need to reuse non-reserved port for reconnect
Date: Thu, 10 May 2018 21:18:32 +0000 [thread overview]
Message-ID: <20180510211832.GC50901@amazon.com> (raw)
In-Reply-To: <1525932774-98736-2-git-send-email-vallish@amazon.com>
On Thu, May 10, 2018 at 06:12:53AM +0000, Vallish Vaidyeshwara wrote:
> Seemingly innocent optimization related to xs_bind() broke TCP port
> reuse by making non-reserved ephermal socket port to not be saved
> in "struct sock_xprt (srcport)". In case of non-reserved port,
> allocation happens as part of kernel_connect() inside of
> xs_tcp_finish_connecting(). kernel_connect() returns EINPROGRESS
> and the code skips stashing srcport in sock_xprt for reconnects.
> This affects servers DRC in case of network partition where client's
> RPC recovery would try reconnecting with a different port.
>
> Reported-by: Alexey Kuznetsov <alexeyk@amazon.com>
> Reviewed-by: Jacob Strauss <jsstraus@amazon.com>
> Reviewed-by: Alakesh Haloi <alakeshh@amazon.com>
> Signed-off-by: Vallish Vaidyeshwara <vallish@amazon.com>
> Fixes: 0f7a622c ("rpc: xs_bind - do not bind when requesting a random ephemeral port")
> ---
> net/sunrpc/xprtsock.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
> index c8902f1..5bf75b3 100644
> --- a/net/sunrpc/xprtsock.c
> +++ b/net/sunrpc/xprtsock.c
> @@ -2393,9 +2393,11 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
> ret = kernel_connect(sock, xs_addr(xprt), xprt->addrlen, O_NONBLOCK);
> switch (ret) {
> case 0:
> - xs_set_srcport(transport, sock);
> /* fall through */
> case -EINPROGRESS:
> + /* Allocated port saved for reconnect */
> + xs_set_srcport(transport, sock);
> +
> /* SYN_SENT! */
> if (xprt->reestablish_timeout < XS_TCP_INIT_REEST_TO)
> xprt->reestablish_timeout = XS_TCP_INIT_REEST_TO;
> --
> 2.7.3.AMZN
>
Hello Trond and Bruce,
This patch is actually restoring existing broken DRC behavior. Can you folks
let me know your feedback on this patch as well.
Thanks.
-Vallish
next prev parent reply other threads:[~2018-05-10 21:18 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 [this message]
2018-05-10 6:12 ` [PATCH 2/2] SUNRPC: Reconnect with new port on server initiated connection termination Vallish Vaidyeshwara
2018-05-10 15:25 ` 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=20180510211832.GC50901@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 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.