summaryrefslogtreecommitdiffstats
path: root/sys/nfsserver
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2004-05-31 16:32:49 +0000
committerrwatson <rwatson@FreeBSD.org>2004-05-31 16:32:49 +0000
commita1a21e421cb0b4bef17c3afbefb8ea90fedbedc1 (patch)
tree6114309bb2a510e6c4c2647b23d61afd06d7d956 /sys/nfsserver
parenta1d2a459f7092cac4925c251d6076dad3739ff46 (diff)
downloadFreeBSD-src-a1a21e421cb0b4bef17c3afbefb8ea90fedbedc1.zip
FreeBSD-src-a1a21e421cb0b4bef17c3afbefb8ea90fedbedc1.tar.gz
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.
Diffstat (limited to 'sys/nfsserver')
-rw-r--r--sys/nfsserver/nfs_syscalls.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/nfsserver/nfs_syscalls.c b/sys/nfsserver/nfs_syscalls.c
index 5a6e2e5..3c6bd56 100644
--- a/sys/nfsserver/nfs_syscalls.c
+++ b/sys/nfsserver/nfs_syscalls.c
@@ -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);
OpenPOWER on IntegriCloud