summaryrefslogtreecommitdiff
path: root/sys/kern/kern_lock.c
diff options
context:
space:
mode:
authorAttilio Rao <attilio@FreeBSD.org>2008-01-11 16:38:12 +0000
committerAttilio Rao <attilio@FreeBSD.org>2008-01-11 16:38:12 +0000
commitd1127e669cc7121e0a4c315e00e7b6b6e87d627b (patch)
treec79988179a5659e9ffbfc0cfc517d61276d672a4 /sys/kern/kern_lock.c
parent548868b38dcb2205e779f8d104c7f247d570b607 (diff)
Notes
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r--sys/kern/kern_lock.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index f623bdc3b40c..5ce5ffdc38ab 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -546,16 +546,19 @@ lockmgr_disown(struct lock *lkp)
struct thread *td;
td = curthread;
- KASSERT(lkp->lk_exclusivecount,
+ KASSERT(panicstr != NULL || lkp->lk_exclusivecount,
("%s: %p lockmgr must be exclusively locked", __func__, lkp));
- KASSERT(lkp->lk_lockholder == td || lkp->lk_lockholder == LK_KERNPROC,
+ KASSERT(panicstr != NULL || lkp->lk_lockholder == td ||
+ lkp->lk_lockholder == LK_KERNPROC,
("%s: %p lockmgr must be locked by curthread (%p)", __func__, lkp,
td));
/*
* Drop the lock reference and switch the owner. This will result
* in an atomic operation like td_lock is only accessed by curthread
- * and lk_lockholder only needs one write.
+ * and lk_lockholder only needs one write. Note also that the lock
+ * owner can be alredy KERNPROC, so in that case just skip the
+ * decrement.
*/
if (lkp->lk_lockholder == td)
td->td_locks--;