aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2008-06-11 23:38:42 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2008-06-23 13:02:50 -0400
commitc7d106c90ec40a0e35a6960157b40f238627246e (patch)
tree21dd79c282982c65f39a00df406dad02cadb6efc /fs/nfsd
parentabd1ec4efd82ca06127bce833ad8a4bbec8a0dcb (diff)
nfsd: fix race in nfsd_nrthreads()
We need the nfsd_mutex before accessing nfsd_serv->sv_nrthreads or we can't even guarantee nfsd_serv will still be there. Signed-off-by: Neil Brown <neilb@suse.de> Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfssvc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 26c81149d49a..96fdbcab8d95 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -165,10 +165,12 @@ int nfsd_vers(int vers, enum vers_op change)
165 165
166int nfsd_nrthreads(void) 166int nfsd_nrthreads(void)
167{ 167{
168 if (nfsd_serv == NULL) 168 int rv = 0;
169 return 0; 169 mutex_lock(&nfsd_mutex);
170 else 170 if (nfsd_serv)
171 return nfsd_serv->sv_nrthreads; 171 rv = nfsd_serv->sv_nrthreads;
172 mutex_unlock(&nfsd_mutex);
173 return rv;
172} 174}
173 175
174static void nfsd_last_thread(struct svc_serv *serv) 176static void nfsd_last_thread(struct svc_serv *serv)