- Closer inspection revealed a possible deadlock situation in vn_lock() that
was introduced by my last commit but not caught by stress testing. Fix that and slightly restructure the code so that it is more readable.
This commit is contained in:
parent
9abf54f032
commit
4b6049cafa
@ -852,25 +852,22 @@ debug_vn_lock(vp, flags, td, filename, line)
|
||||
vp->v_iflag |= VI_XWANT;
|
||||
msleep(vp, VI_MTX(vp), PINOD | PDROP,
|
||||
"vn_lock", 0);
|
||||
/*
|
||||
* Since we're just going to return, unlock interlock.
|
||||
*/
|
||||
if ((flags & LK_RETRY) == 0)
|
||||
VI_UNLOCK(vp);
|
||||
error = ENOENT;
|
||||
} else {
|
||||
#ifdef DEBUG_LOCKS
|
||||
vp->filename = filename;
|
||||
vp->line = line;
|
||||
#endif
|
||||
/*
|
||||
* lockmgr drops interlock before it will return for
|
||||
* any reason. So force the code above to relock it.
|
||||
*/
|
||||
error = VOP_LOCK(vp,
|
||||
flags | LK_NOPAUSE | LK_INTERLOCK, td);
|
||||
flags &= ~LK_INTERLOCK;
|
||||
if ((flags & LK_RETRY) == 0) {
|
||||
VI_UNLOCK(vp);
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG_LOCKS
|
||||
vp->filename = filename;
|
||||
vp->line = line;
|
||||
#endif
|
||||
/*
|
||||
* lockmgr drops interlock before it will return for
|
||||
* any reason. So force the code above to relock it.
|
||||
*/
|
||||
error = VOP_LOCK(vp, flags | LK_NOPAUSE | LK_INTERLOCK, td);
|
||||
flags &= ~LK_INTERLOCK;
|
||||
} while (flags & LK_RETRY && error != 0);
|
||||
return (error);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user