Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Feb 2009 19:10:43 +0000 (UTC)
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r189194 - head/sys/kern
Message-ID:  <200902281910.n1SJAho3019235@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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();



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