mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 16:29:59 +00:00
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>
This commit is contained in:
parent
abd1ec4efd
commit
c7d106c90e
1 changed files with 6 additions and 4 deletions
|
@ -165,10 +165,12 @@ int nfsd_vers(int vers, enum vers_op change)
|
|||
|
||||
int nfsd_nrthreads(void)
|
||||
{
|
||||
if (nfsd_serv == NULL)
|
||||
return 0;
|
||||
else
|
||||
return nfsd_serv->sv_nrthreads;
|
||||
int rv = 0;
|
||||
mutex_lock(&nfsd_mutex);
|
||||
if (nfsd_serv)
|
||||
rv = nfsd_serv->sv_nrthreads;
|
||||
mutex_unlock(&nfsd_mutex);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static void nfsd_last_thread(struct svc_serv *serv)
|
||||
|
|
Loading…
Reference in a new issue