summaryrefslogtreecommitdiff
path: root/net/sunrpc/xprt.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2021-10-27 01:01:07 +0300
committerTrond Myklebust <trond.myklebust@hammerspace.com>2021-11-05 02:46:19 +0300
commit3be232f11a3cc9b0ef0795e39fa11bdb8e422a06 (patch)
tree273fc671f6aa2652a503818ba1b35f69fafcd751 /net/sunrpc/xprt.c
parentd896ba8300ebd09e5fc9c43051d9eb36b65e996e (diff)
downloadlinux-3be232f11a3cc9b0ef0795e39fa11bdb8e422a06.tar.xz
SUNRPC: Prevent immediate close+reconnect
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>
Diffstat (limited to 'net/sunrpc/xprt.c')
-rw-r--r--net/sunrpc/xprt.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 691fe5a682b6..a02de2bddb28 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -767,7 +767,8 @@ EXPORT_SYMBOL_GPL(xprt_disconnect_done);
*/
static void xprt_schedule_autoclose_locked(struct rpc_xprt *xprt)
{
- set_bit(XPRT_CLOSE_WAIT, &xprt->state);
+ if (test_and_set_bit(XPRT_CLOSE_WAIT, &xprt->state))
+ return;
if (test_and_set_bit(XPRT_LOCKED, &xprt->state) == 0)
queue_work(xprtiod_workqueue, &xprt->task_cleanup);
else if (xprt->snd_task && !test_bit(XPRT_SND_IS_COOKIE, &xprt->state))