svn commit: r251323 - head/sys/kern

John Baldwin jhb at FreeBSD.org
Mon Jun 3 17:38:58 UTC 2013


Author: jhb
Date: Mon Jun  3 17:38:57 2013
New Revision: 251323
URL: http://svnweb.freebsd.org/changeset/base/251323

Log:
  - Handle the recursed/not recursed flags with RA_RLOCKED in rw_assert().
  - Tweak a panic message.

Modified:
  head/sys/kern/kern_rwlock.c

Modified: head/sys/kern/kern_rwlock.c
==============================================================================
--- head/sys/kern/kern_rwlock.c	Mon Jun  3 17:36:43 2013	(r251322)
+++ head/sys/kern/kern_rwlock.c	Mon Jun  3 17:38:57 2013	(r251323)
@@ -371,7 +371,7 @@ __rw_rlock(volatile uintptr_t *c, const 
 	KASSERT(rw->rw_lock != RW_DESTROYED,
 	    ("rw_rlock() of destroyed rwlock @ %s:%d", file, line));
 	KASSERT(rw_wowner(rw) != curthread,
-	    ("%s (%s): wlock already held @ %s:%d", __func__,
+	    ("rw_rlock: wlock already held for %s @ %s:%d",
 	    rw->lock_object.lo_name, file, line));
 	WITNESS_CHECKORDER(&rw->lock_object, LOP_NEWORDER, file, line, NULL);
 
@@ -1124,6 +1124,8 @@ __rw_assert(const volatile uintptr_t *c,
 	case RA_LOCKED | RA_RECURSED:
 	case RA_LOCKED | RA_NOTRECURSED:
 	case RA_RLOCKED:
+	case RA_RLOCKED | RA_RECURSED:
+	case RA_RLOCKED | RA_NOTRECURSED:
 #ifdef WITNESS
 		witness_assert(&rw->lock_object, what, file, line);
 #else
@@ -1133,13 +1135,13 @@ __rw_assert(const volatile uintptr_t *c,
 		 * has a lock at all, fail.
 		 */
 		if (rw->rw_lock == RW_UNLOCKED ||
-		    (!(rw->rw_lock & RW_LOCK_READ) && (what == RA_RLOCKED ||
+		    (!(rw->rw_lock & RW_LOCK_READ) && (what & RA_RLOCKED ||
 		    rw_wowner(rw) != curthread)))
 			panic("Lock %s not %slocked @ %s:%d\n",
-			    rw->lock_object.lo_name, (what == RA_RLOCKED) ?
+			    rw->lock_object.lo_name, (what & RA_RLOCKED) ?
 			    "read " : "", file, line);
 
-		if (!(rw->rw_lock & RW_LOCK_READ)) {
+		if (!(rw->rw_lock & RW_LOCK_READ) && !(what & RA_RLOCKED)) {
 			if (rw_recursed(rw)) {
 				if (what & RA_NOTRECURSED)
 					panic("Lock %s recursed @ %s:%d\n",


More information about the svn-src-head mailing list