svn commit: r252172 - stable/9/sys/kern
John Baldwin
jhb at FreeBSD.org
Mon Jun 24 19:18:02 UTC 2013
Author: jhb
Date: Mon Jun 24 19:18:01 2013
New Revision: 252172
URL: http://svnweb.freebsd.org/changeset/base/252172
Log:
MFC 251323:
- Handle the recursed/not recursed flags with RA_RLOCKED in rw_assert().
- Tweak a panic message.
Modified:
stable/9/sys/kern/kern_rwlock.c
Directory Properties:
stable/9/sys/ (props changed)
Modified: stable/9/sys/kern/kern_rwlock.c
==============================================================================
--- stable/9/sys/kern/kern_rwlock.c Mon Jun 24 19:14:09 2013 (r252171)
+++ stable/9/sys/kern/kern_rwlock.c Mon Jun 24 19:18:01 2013 (r252172)
@@ -330,7 +330,7 @@ _rw_rlock(struct rwlock *rw, const char
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);
@@ -1055,6 +1055,8 @@ _rw_assert(struct rwlock *rw, int what,
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
@@ -1064,13 +1066,13 @@ _rw_assert(struct rwlock *rw, int what,
* 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-stable-9
mailing list