Skip to content

Commit

Permalink
SUNRPC: lock the socket while detaching it
Browse files Browse the repository at this point in the history
Prevent callbacks from triggering while we're detaching the socket.

Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: J. Bruce Fields <[email protected]>
  • Loading branch information
trondmypd authored and J. Bruce Fields committed Jul 13, 2016
1 parent 104f635 commit 069c225
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/sunrpc/svcsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1611,9 +1611,12 @@ static void svc_sock_detach(struct svc_xprt *xprt)
dprintk("svc: svc_sock_detach(%p)\n", svsk);

/* put back the old socket callbacks */
lock_sock(sk);
sk->sk_state_change = svsk->sk_ostate;
sk->sk_data_ready = svsk->sk_odata;
sk->sk_write_space = svsk->sk_owspace;
sk->sk_user_data = NULL;
release_sock(sk);

wq = sk_sleep(sk);
if (sunrpc_waitqueue_active(wq))
Expand Down

0 comments on commit 069c225

Please sign in to comment.