diff options
author | rwatson <rwatson@FreeBSD.org> | 2005-09-27 21:02:59 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2005-09-27 21:02:59 +0000 |
commit | b95808bd5290a37b39d3833fe850627a517ab5c7 (patch) | |
tree | 6841e6b80764699873ca20fcf0c8432302434de8 /sys/kern/kern_lock.c | |
parent | 5da7730d32c8c82c5ece12deed530ceebf231796 (diff) | |
download | FreeBSD-src-b95808bd5290a37b39d3833fe850627a517ab5c7.zip FreeBSD-src-b95808bd5290a37b39d3833fe850627a517ab5c7.tar.gz |
In lockstatus(), don't lock and unlock the interlock when testing the
sleep lock status while kdb_active, or we risk contending with the
mutex on another CPU, resulting in a panic when using "show
lockedvnods" while in DDB.
MFC after: 3 days
Reviewed by: jhb
Reported by: kris
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r-- | sys/kern/kern_lock.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index c53683c..12c0d9c 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -526,8 +526,13 @@ lockstatus(lkp, td) struct thread *td; { int lock_type = 0; + int interlocked; - mtx_lock(lkp->lk_interlock); + if (!kdb_active) { + interlocked = 1; + mtx_lock(lkp->lk_interlock); + } else + interlocked = 0; if (lkp->lk_exclusivecount != 0) { if (td == NULL || lkp->lk_lockholder == td) lock_type = LK_EXCLUSIVE; @@ -535,7 +540,8 @@ lockstatus(lkp, td) lock_type = LK_EXCLOTHER; } else if (lkp->lk_sharecount != 0) lock_type = LK_SHARED; - mtx_unlock(lkp->lk_interlock); + if (interlocked) + mtx_unlock(lkp->lk_interlock); return (lock_type); } |