提交 c7d106c9 编写于 作者: N Neil Brown 提交者: J. Bruce Fields

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: NNeil Brown <neilb@suse.de>
Acked-by: NJeff Layton <jlayton@redhat.com>
Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
上级 abd1ec4e
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册