- If we are called with LK_NOWAIT in vn_lock() we may be holding a mutex

and should not sleep while waiting for XLOCK to clear.  Care needs to be
   taken in functions that use this capability to avoid spinning.
This commit is contained in:
jeff 2003-10-04 14:35:22 +00:00
parent 131f8a6764
commit d5d3718254

View File

@ -870,12 +870,15 @@ debug_vn_lock(vp, flags, td, filename, line)
if ((flags & LK_INTERLOCK) == 0)
VI_LOCK(vp);
if ((vp->v_iflag & VI_XLOCK) && vp->v_vxproc != curthread) {
if ((flags & LK_NOWAIT) != 0) {
VI_UNLOCK(vp);
return (ENOENT);
}
vp->v_iflag |= VI_XWANT;
msleep(vp, VI_MTX(vp), PINOD, "vn_lock", 0);
error = ENOENT;
if ((flags & LK_RETRY) == 0) {
VI_UNLOCK(vp);
return (error);
return (ENOENT);
}
}
#ifdef DEBUG_LOCKS