assert_vop_locked: make the assertion race-free and more efficient

this is really a minor improvement for the sake of correctness

MFC after:	6 days
This commit is contained in:
Andriy Gapon 2012-11-24 13:11:47 +00:00
parent 59e407dfbf
commit 6b991098a7

View file

@ -3979,10 +3979,13 @@ assert_vi_unlocked(struct vnode *vp, const char *str)
void
assert_vop_locked(struct vnode *vp, const char *str)
{
int locked;
if (!IGNORE_LOCK(vp) &&
(VOP_ISLOCKED(vp) == 0 || VOP_ISLOCKED(vp) == LK_EXCLOTHER))
vfs_badlock("is not locked but should be", str, vp);
if (!IGNORE_LOCK(vp)) {
locked = VOP_ISLOCKED(vp);
if (locked == 0 || locked == LK_EXCLOTHER)
vfs_badlock("is not locked but should be", str, vp);
}
}
void