mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 04:34:08 +08:00
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>
This commit is contained in:
parent
127becabad
commit
d896ba8300
@ -735,6 +735,8 @@ static void xprt_autoclose(struct work_struct *work)
|
||||
unsigned int pflags = memalloc_nofs_save();
|
||||
|
||||
trace_xprt_disconnect_auto(xprt);
|
||||
xprt->connect_cookie++;
|
||||
smp_mb__before_atomic();
|
||||
clear_bit(XPRT_CLOSE_WAIT, &xprt->state);
|
||||
xprt->ops->close(xprt);
|
||||
xprt_release_write(xprt, NULL);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user