Skip to content

Commit 0842b4c

Browse files
jtlaytonchucklever
authored andcommitted
NFSD: move nfsd_mutex handling into nfsd_svc callers
Currently nfsd_svc holds the nfsd_mutex over the whole function. For some of the later netlink patches though, we want to do some other things to the server before starting it. Move the mutex handling into the callers. Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 03b0036 commit 0842b4c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

fs/nfsd/nfsctl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,9 @@ static ssize_t write_threads(struct file *file, char *buf, size_t size)
404404
if (newthreads < 0)
405405
return -EINVAL;
406406
trace_nfsd_ctl_threads(net, newthreads);
407+
mutex_lock(&nfsd_mutex);
407408
rv = nfsd_svc(newthreads, net, file->f_cred);
409+
mutex_unlock(&nfsd_mutex);
408410
if (rv < 0)
409411
return rv;
410412
} else

fs/nfsd/nfssvc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,8 @@ nfsd_svc(int nrservs, struct net *net, const struct cred *cred)
775775
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
776776
struct svc_serv *serv;
777777

778-
mutex_lock(&nfsd_mutex);
778+
lockdep_assert_held(&nfsd_mutex);
779+
779780
dprintk("nfsd: creating service\n");
780781

781782
nrservs = max(nrservs, 0);
@@ -804,7 +805,6 @@ nfsd_svc(int nrservs, struct net *net, const struct cred *cred)
804805
if (serv->sv_nrthreads == 0)
805806
nfsd_destroy_serv(net);
806807
out:
807-
mutex_unlock(&nfsd_mutex);
808808
return error;
809809
}
810810

0 commit comments

Comments
 (0)