- 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:
parent
131f8a6764
commit
d5d3718254
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user