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
This commit is contained in:
Robert Watson 2002-09-30 20:51:48 +00:00
parent c031391bd5
commit 0626774f08
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=104237

View File

@ -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);