Add an assertion that nfssvc() isn't called with Giant.
Add two additional pairs of assertions, one at the end of the NFS server event loop, and one one exit from the NFS daemon, that assert that if debug.mpsafenet is enabled, Giant is not held, and that if it is not enabled, Giant will be held. This is intended to support debugging scenarios where Giant is "leaked" during NFS processing.
This commit is contained in:
parent
4f16b8b190
commit
4fa649df8e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=129894
@ -134,6 +134,8 @@ nfssvc(struct thread *td, struct nfssvc_args *uap)
|
||||
struct nfsd_args nfsdarg;
|
||||
int error;
|
||||
|
||||
KASSERT(!mtx_owned(&Giant), ("nfssvc(): called with Giant"));
|
||||
|
||||
#ifdef MAC
|
||||
error = mac_check_system_nfsd(td->td_ucred);
|
||||
if (error)
|
||||
@ -550,8 +552,16 @@ nfssvc_nfsd(struct thread *td)
|
||||
nfsd->nfsd_slp = NULL;
|
||||
nfsrv_slpderef(slp);
|
||||
}
|
||||
KASSERT(!(debug_mpsafenet == 0 && !mtx_owned(&Giant)),
|
||||
("nfssvc_nfsd(): debug.mpsafenet=0 && !Giant"));
|
||||
KASSERT(!(debug_mpsafenet == 1 && mtx_owned(&Giant)),
|
||||
("nfssvc_nfsd(): debug.mpsafenet=1 && Giant"));
|
||||
}
|
||||
done:
|
||||
KASSERT(!(debug_mpsafenet == 0 && !mtx_owned(&Giant)),
|
||||
("nfssvc_nfsd(): debug.mpsafenet=0 && !Giant"));
|
||||
KASSERT(!(debug_mpsafenet == 1 && mtx_owned(&Giant)),
|
||||
("nfssvc_nfsd(): debug.mpsafenet=1 && Giant"));
|
||||
TAILQ_REMOVE(&nfsd_head, nfsd, nfsd_chain);
|
||||
splx(s);
|
||||
free((caddr_t)nfsd, M_NFSD);
|
||||
|
Loading…
Reference in New Issue
Block a user