public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: trondmy@kernel.org
To: linux-nfs@vger.kernel.org
Subject: [PATCH 4/4] SUNRPC: Prevent immediate close+reconnect
Date: Fri, 29 Oct 2021 16:04:21 -0400	[thread overview]
Message-ID: <20211029200421.65090-4-trondmy@kernel.org> (raw)
In-Reply-To: <20211029200421.65090-3-trondmy@kernel.org>

From: Trond Myklebust <trond.myklebust@hammerspace.com>

If we have already set up the socket and are waiting for it to connect,
then don't immediately close and retry.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 net/sunrpc/xprtsock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 7fb302e202bc..ae48c9c84ee1 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -2314,7 +2314,7 @@ static void xs_connect(struct rpc_xprt *xprt, struct rpc_task *task)
 
 	WARN_ON_ONCE(!xprt_lock_connect(xprt, task, transport));
 
-	if (transport->sock != NULL) {
+	if (transport->sock != NULL && !xprt_connecting(xprt)) {
 		dprintk("RPC:       xs_connect delayed xprt %p for %lu "
 				"seconds\n",
 				xprt, xprt->reestablish_timeout / HZ);
-- 
2.31.1


  reply	other threads:[~2021-10-29 20:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-29 20:04 [PATCH 1/4] SUNRPC: Fix races when closing the socket trondmy
2021-10-29 20:04 ` [PATCH 2/4] SUNRPC: Replace use of socket sk_callback_lock with sock_lock trondmy
2021-10-29 20:04   ` [PATCH 3/4] SUNRPC: Clean up xs_tcp_setup_sock() trondmy
2021-10-29 20:04     ` trondmy [this message]
2021-12-03 16:10     ` David Wysochanski
2021-12-03 16:36       ` David Wysochanski
2021-10-30 14:53 ` [PATCH 1/4] SUNRPC: Fix races when closing the socket David Wysochanski

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=20211029200421.65090-4-trondmy@kernel.org \
    --to=trondmy@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox