Commit 9d3792ae authored by NeilBrown's avatar NeilBrown Committed by Chuck Lever

NFSD: narrow nfsd_mutex protection in nfsd thread

There is nothing happening in the start of nfsd() that requires
protection by the mutex, so don't take it until shutting down the thread
- which does still require protection - but only for nfsd_put().
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 2a36395f
...@@ -932,9 +932,6 @@ nfsd(void *vrqstp) ...@@ -932,9 +932,6 @@ nfsd(void *vrqstp)
struct nfsd_net *nn = net_generic(net, nfsd_net_id); struct nfsd_net *nn = net_generic(net, nfsd_net_id);
int err; int err;
/* Lock module and set up kernel thread */
mutex_lock(&nfsd_mutex);
/* At this point, the thread shares current->fs /* At this point, the thread shares current->fs
* with the init process. We need to create files with the * with the init process. We need to create files with the
* umask as defined by the client instead of init's umask. */ * umask as defined by the client instead of init's umask. */
...@@ -954,7 +951,6 @@ nfsd(void *vrqstp) ...@@ -954,7 +951,6 @@ nfsd(void *vrqstp)
allow_signal(SIGINT); allow_signal(SIGINT);
allow_signal(SIGQUIT); allow_signal(SIGQUIT);
mutex_unlock(&nfsd_mutex);
atomic_inc(&nfsdstats.th_cnt); atomic_inc(&nfsdstats.th_cnt);
set_freezable(); set_freezable();
...@@ -983,7 +979,6 @@ nfsd(void *vrqstp) ...@@ -983,7 +979,6 @@ nfsd(void *vrqstp)
flush_signals(current); flush_signals(current);
atomic_dec(&nfsdstats.th_cnt); atomic_dec(&nfsdstats.th_cnt);
mutex_lock(&nfsd_mutex);
out: out:
/* Take an extra ref so that the svc_put in svc_exit_thread() /* Take an extra ref so that the svc_put in svc_exit_thread()
...@@ -995,10 +990,11 @@ nfsd(void *vrqstp) ...@@ -995,10 +990,11 @@ nfsd(void *vrqstp)
svc_exit_thread(rqstp); svc_exit_thread(rqstp);
/* Now if needed we call svc_destroy in appropriate context */ /* Now if needed we call svc_destroy in appropriate context */
mutex_lock(&nfsd_mutex);
nfsd_put(net); nfsd_put(net);
mutex_unlock(&nfsd_mutex);
/* Release module */ /* Release module */
mutex_unlock(&nfsd_mutex);
module_put_and_exit(0); module_put_and_exit(0);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment