summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_lock.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2013-06-03 17:41:11 +0000
committerjhb <jhb@FreeBSD.org>2013-06-03 17:41:11 +0000
commitfbe58039391c863167ca77024f95b85e67f14ce5 (patch)
treebe1bd195336606e60192d4440ae2e532344031e2 /sys/kern/kern_lock.c
parenta2b00a43740f58ac5f2b7f65c4a89092fcea32e9 (diff)
downloadFreeBSD-src-fbe58039391c863167ca77024f95b85e67f14ce5.zip
FreeBSD-src-fbe58039391c863167ca77024f95b85e67f14ce5.tar.gz
- Fix a couple of inverted panic messages for shared/exclusive mismatches
of a lock within a single thread. - Fix handling of interlocks in WITNESS by properly requiring the interlock to be held exactly once if it is specified.
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r--sys/kern/kern_lock.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index 849f583..f0eedd8 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -511,7 +511,7 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk,
case LK_SHARED:
if (LK_CAN_WITNESS(flags))
WITNESS_CHECKORDER(&lk->lock_object, LOP_NEWORDER,
- file, line, ilk);
+ file, line, flags & LK_INTERLOCK ? ilk : NULL);
for (;;) {
x = lk->lk_lock;
@@ -723,7 +723,8 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk,
case LK_EXCLUSIVE:
if (LK_CAN_WITNESS(flags))
WITNESS_CHECKORDER(&lk->lock_object, LOP_NEWORDER |
- LOP_EXCLUSIVE, file, line, ilk);
+ LOP_EXCLUSIVE, file, line, flags & LK_INTERLOCK ?
+ ilk : NULL);
/*
* If curthread already holds the lock and this one is
@@ -1072,7 +1073,8 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk,
case LK_DRAIN:
if (LK_CAN_WITNESS(flags))
WITNESS_CHECKORDER(&lk->lock_object, LOP_NEWORDER |
- LOP_EXCLUSIVE, file, line, ilk);
+ LOP_EXCLUSIVE, file, line, flags & LK_INTERLOCK ?
+ ilk : NULL);
/*
* Trying to drain a lock we already own will result in a
OpenPOWER on IntegriCloud