]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
SUNRPC: Fix races between socket connection and destroy code
authorTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 17 Sep 2015 14:42:27 +0000 (10:42 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 17 Sep 2015 19:48:23 +0000 (15:48 -0400)
When we're destroying the socket transport, we need to ensure that
we cancel any existing delayed connection attempts, and order them
w.r.t. the call to xs_close().

Reported-by:"Suzuki K. Poulose" <suzuki.poulose@arm.com>
Acked-by: Jeff Layton <jlayton@poochiereds.net>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
net/sunrpc/xprtsock.c

index 7be90bc1a7c26c2c4b998e4b21ca319df19f9638..d2dfbd043bea9fd5e34a68cfb12082b9102761ac 100644 (file)
@@ -881,8 +881,11 @@ static void xs_xprt_free(struct rpc_xprt *xprt)
  */
 static void xs_destroy(struct rpc_xprt *xprt)
 {
+       struct sock_xprt *transport = container_of(xprt,
+                       struct sock_xprt, xprt);
        dprintk("RPC:       xs_destroy xprt %p\n", xprt);
 
+       cancel_delayed_work_sync(&transport->connect_worker);
        xs_close(xprt);
        xs_xprt_free(xprt);
        module_put(THIS_MODULE);