Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Nov 2012 13:11:48 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r243499 - head/sys/kern
Message-ID:  <201211241311.qAODBmNI057704@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Sat Nov 24 13:11:47 2012
New Revision: 243499
URL: http://svnweb.freebsd.org/changeset/base/243499

Log:
  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

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Sat Nov 24 13:10:36 2012	(r243498)
+++ head/sys/kern/vfs_subr.c	Sat Nov 24 13:11:47 2012	(r243499)
@@ -3979,10 +3979,13 @@ assert_vi_unlocked(struct vnode *vp, con
 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201211241311.qAODBmNI057704>