diff options
author | avg <avg@FreeBSD.org> | 2012-11-24 13:11:47 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2012-11-24 13:11:47 +0000 |
commit | 9c2d52ecdeada4a95b085a934ffcfb6123bfea18 (patch) | |
tree | ee7a7658303f7ba36ebe4df6f83f5f16e9dfc343 /sys/kern/vfs_subr.c | |
parent | 38c3b37a84fbc45f59fd6de210100fc534fddb10 (diff) | |
download | FreeBSD-src-9c2d52ecdeada4a95b085a934ffcfb6123bfea18.zip FreeBSD-src-9c2d52ecdeada4a95b085a934ffcfb6123bfea18.tar.gz |
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
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r-- | sys/kern/vfs_subr.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index ef6edd2..1c3c332 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -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 |