svn commit: r189194 - head/sys/kern

Andrew Thompson thompsa at FreeBSD.org
Sat Feb 28 11:10:46 PST 2009


Author: thompsa
Date: Sat Feb 28 19:10:43 2009
New Revision: 189194
URL: http://svn.freebsd.org/changeset/base/189194

Log:
  Move the NORELEASE check to after the recurse count decrement and bailout, this
  is not counted as actually releasing the lock.

Modified:
  head/sys/kern/subr_witness.c

Modified: head/sys/kern/subr_witness.c
==============================================================================
--- head/sys/kern/subr_witness.c	Sat Feb 28 19:09:36 2009	(r189193)
+++ head/sys/kern/subr_witness.c	Sat Feb 28 19:10:43 2009	(r189194)
@@ -1511,12 +1511,6 @@ found:
 		    instance->li_line);
 		panic("share->uexcl");
 	}
-	if ((instance->li_flags & LI_NORELEASE) != 0 && witness_watch > 0) {
-		printf("forbidden unlock of (%s) %s @ %s:%d\n", class->lc_name,
-		    lock->lo_name, file, line);
-		panic("lock marked norelease");
-	}
-
 	/* If we are recursed, unrecurse. */
 	if ((instance->li_flags & LI_RECURSEMASK) > 0) {
 		CTR4(KTR_WITNESS, "%s: pid %d unrecursed on %s r=%d", __func__,
@@ -1525,6 +1519,12 @@ found:
 		instance->li_flags--;
 		return;
 	}
+	/* The lock is now being dropped, check for NORELEASE flag */
+	if ((instance->li_flags & LI_NORELEASE) != 0 && witness_watch > 0) {
+		printf("forbidden unlock of (%s) %s @ %s:%d\n", class->lc_name,
+		    lock->lo_name, file, line);
+		panic("lock marked norelease");
+	}
 
 	/* Otherwise, remove this item from the list. */
 	s = intr_disable();


More information about the svn-src-head mailing list