Handle the case when a thread is blocked on a lockmgr lock with LK_DRAIN

in DDB's 'show sleepchain'.

MFC after:	3 days
This commit is contained in:
jhb 2007-03-21 19:28:20 +00:00
parent 46edec2346
commit 08da44e275

View File

@ -661,9 +661,22 @@ lockmgr_chain(struct thread *td, struct thread **ownerp)
lkp = td->td_wchan;
/* Simple test to see if wchan points to a lockmgr lock. */
if (lkp->lk_wmesg != td->td_wmesg)
return (0);
if (lkp->lk_wmesg == td->td_wmesg)
goto ok;
/*
* If this thread is doing a DRAIN, then it would be asleep on
* &lkp->lk_flags rather than lkp.
*/
lkp = (struct lock *)((char *)td->td_wchan -
offsetof(struct lock, lk_flags));
if (lkp->lk_wmesg == td->td_wmesg && (lkp->lk_flags & LK_WAITDRAIN))
goto ok;
/* Doen't seem to be a lockmgr lock. */
return (0);
ok:
/* Ok, we think we have a lockmgr lock, so output some details. */
db_printf("blocked on lk \"%s\" ", lkp->lk_wmesg);
if (lkp->lk_sharecount) {