aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2021-10-29 12:26:17 -0400
committerTrond Myklebust <trond.myklebust@hammerspace.com>2021-11-04 19:46:19 -0400
commitd896ba8300ebd09e5fc9c43051d9eb36b65e996e (patch)
tree7ca16fb82801fa28a737440a3a2985a532090125 /net/sunrpc/xprtsock.c
parentNFSv4.2 add tracepoint to OFFLOAD_CANCEL (diff)
downloadlinux-dev-d896ba8300ebd09e5fc9c43051d9eb36b65e996e.tar.xz
linux-dev-d896ba8300ebd09e5fc9c43051d9eb36b65e996e.zip
SUNRPC: Fix races when closing the socket
Ensure that we bump the xprt->connect_cookie when we set the XPRT_CLOSE_WAIT flag so that another call to xprt_conditional_disconnect() won't race with the reconnection. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to '')
-rw-r--r--net/sunrpc/xprtsock.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index aa293e4a77fa..7fb302e202bc 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1134,6 +1134,7 @@ static void xs_run_error_worker(struct sock_xprt *transport, unsigned int nr)
static void xs_sock_reset_connection_flags(struct rpc_xprt *xprt)
{
+ xprt->connect_cookie++;
smp_mb__before_atomic();
clear_bit(XPRT_CLOSE_WAIT, &xprt->state);
clear_bit(XPRT_CLOSING, &xprt->state);