diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -138,9 +138,6 @@ #define LK_TRYWIT(x) \ (LK_TRYOP(x) ? LOP_TRYLOCK : 0) -#define lockmgr_disowned(lk) \ - (((lk)->lk_lock & ~(LK_FLAGMASK & ~LK_SHARE)) == LK_KERNPROC) - #define lockmgr_xlocked_v(v) \ (((v) & ~(LK_FLAGMASK & ~LK_SHARE)) == (uintptr_t)curthread) @@ -243,7 +240,7 @@ lockmgr_note_exclusive_release(struct lock *lk, const char *file, int line) { - if (LK_HOLDER(lockmgr_read_value(lk)) != LK_KERNPROC) { + if (!lockmgr_disowned(lk)) { WITNESS_UNLOCK(&lk->lock_object, LOP_EXCLUSIVE, file, line); TD_LOCKS_DEC(curthread); } @@ -1135,7 +1132,7 @@ * any waiter. * Fix-up the tid var if the lock has been disowned. */ - if (LK_HOLDER(x) == LK_KERNPROC) + if (lockmgr_disowned_v(x)) tid = LK_KERNPROC; /* diff --git a/sys/sys/lockmgr.h b/sys/sys/lockmgr.h --- a/sys/sys/lockmgr.h +++ b/sys/sys/lockmgr.h @@ -130,6 +130,10 @@ LOCK_FILE, LOCK_LINE) #define lockmgr_disown(lk) \ _lockmgr_disown((lk), LOCK_FILE, LOCK_LINE) +#define lockmgr_disowned_v(v) \ + (LK_HOLDER((v)) == LK_KERNPROC) +#define lockmgr_disowned(lk) \ + lockmgr_disowned_v(lockmgr_read_value((lk))) #define lockmgr_recursed_v(v) \ (v & LK_WRITER_RECURSED) #define lockmgr_recursed(lk) \