From 0626774f08385d4de160a6f29e4c594df1f480b1 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Mon, 30 Sep 2002 20:51:48 +0000 Subject: [PATCH] Move vnode MAC label initialization to after the release of the vnode interlock in getnewvnode() to avoid possible sleeps while holding the mutex. Note that the warning from Witness is a slight false positive since we know there will be no contention on the interlock since we haven't made the vnode available for use yet, but the theory is not a bad one. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories --- sys/kern/vfs_subr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 56ca7bee8680..144d3da410b2 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -990,14 +990,14 @@ getnewvnode(tag, mp, vops, vpp) vp->v_tag = tag; vp->v_op = vops; lockinit(&vp->v_lock, PVFS, "vnlock", VLKTIMEOUT, LK_NOPAUSE); -#ifdef MAC - mac_init_vnode(vp); -#endif *vpp = vp; vp->v_usecount = 1; vp->v_data = 0; vp->v_cachedid = -1; VI_UNLOCK(vp); +#ifdef MAC + mac_init_vnode(vp); +#endif insmntque(vp, mp); return (0);