1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-18 15:30:21 +00:00

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
This commit is contained in:
Robert Watson 2005-09-27 21:02:59 +00:00
parent d8e205ef93
commit 2b59d50cfb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=150646

View File

@ -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);
}