Commit 8265e34e authored by Trond Myklebust's avatar Trond Myklebust Committed by Greg Kroah-Hartman

SUNRPC: Fix a race with XPRT_CONNECTING

[ Upstream commit cf76785d ]

Ensure that we clear XPRT_CONNECTING before releasing the XPRT_LOCK so that
we don't have races between the (asynchronous) socket setup code and
tasks in xprt_connect().
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Tested-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 1eac41ba
...@@ -2223,8 +2223,8 @@ static void xs_udp_setup_socket(struct work_struct *work) ...@@ -2223,8 +2223,8 @@ static void xs_udp_setup_socket(struct work_struct *work)
trace_rpc_socket_connect(xprt, sock, 0); trace_rpc_socket_connect(xprt, sock, 0);
status = 0; status = 0;
out: out:
xprt_unlock_connect(xprt, transport);
xprt_clear_connecting(xprt); xprt_clear_connecting(xprt);
xprt_unlock_connect(xprt, transport);
xprt_wake_pending_tasks(xprt, status); xprt_wake_pending_tasks(xprt, status);
} }
...@@ -2451,8 +2451,8 @@ static void xs_tcp_setup_socket(struct work_struct *work) ...@@ -2451,8 +2451,8 @@ static void xs_tcp_setup_socket(struct work_struct *work)
} }
status = -EAGAIN; status = -EAGAIN;
out: out:
xprt_unlock_connect(xprt, transport);
xprt_clear_connecting(xprt); xprt_clear_connecting(xprt);
xprt_unlock_connect(xprt, transport);
xprt_wake_pending_tasks(xprt, status); xprt_wake_pending_tasks(xprt, status);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment