mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +00:00
- Handle the recursed/not recursed flags with RA_RLOCKED in rw_assert().
- Tweak a panic message.
This commit is contained in:
parent
d39116f5d5
commit
95d28652af
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=251323
@ -371,7 +371,7 @@ __rw_rlock(volatile uintptr_t *c, const char *file, int line)
|
||||
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, int what, const char *file, int line)
|
||||
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, int what, const char *file, int line)
|
||||
* 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",
|
||||
|
Loading…
Reference in New Issue
Block a user