OSDN Git Service

SUNRPC: lock the socket while detaching it
authorTrond Myklebust <trond.myklebust@primarydata.com>
Fri, 24 Jun 2016 14:55:47 +0000 (10:55 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 13 Jul 2016 19:53:44 +0000 (15:53 -0400)
Prevent callbacks from triggering while we're detaching the socket.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
net/sunrpc/svcsock.c

index dadfec6..abe2da6 100644 (file)
@@ -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))