Date: Mon, 3 Jun 2013 17:38:58 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251323 - head/sys/kern Message-ID: <201306031738.r53Hcw3M093883@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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",
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306031738.r53Hcw3M093883>