nfs: do not start the callback thread until we set rqstp->rq_task
authorTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 2 Sep 2014 17:58:58 +0000 (13:58 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Tue, 2 Sep 2014 21:53:30 +0000 (17:53 -0400)
This fixes an Oopsable race when starting up the callback server.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Reviewed-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfs/callback.c

index e3dd1cd175d9edb803a02c37c01035300dc364d6..b8fb3a4ef64955789bc4c42f297d33e8a52939cf 100644 (file)
@@ -235,7 +235,7 @@ static int nfs_callback_start_svc(int minorversion, struct rpc_xprt *xprt,
 
        cb_info->serv = serv;
        cb_info->rqst = rqstp;
-       cb_info->task = kthread_run(callback_svc, cb_info->rqst,
+       cb_info->task = kthread_create(callback_svc, cb_info->rqst,
                                    "nfsv4.%u-svc", minorversion);
        if (IS_ERR(cb_info->task)) {
                ret = PTR_ERR(cb_info->task);
@@ -245,6 +245,7 @@ static int nfs_callback_start_svc(int minorversion, struct rpc_xprt *xprt,
                return ret;
        }
        rqstp->rq_task = cb_info->task;
+       wake_up_process(cb_info->task);
        dprintk("nfs_callback_up: service started\n");
        return 0;
 }