From owner-p4-projects@FreeBSD.ORG Thu Aug 17 19:48:13 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DFF1616A4E2; Thu, 17 Aug 2006 19:48:12 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7104A16A4DD for ; Thu, 17 Aug 2006 19:48:12 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 377AC43D49 for ; Thu, 17 Aug 2006 19:48:12 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k7HJmCIu079496 for ; Thu, 17 Aug 2006 19:48:12 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k7HJmBwq079493 for perforce@freebsd.org; Thu, 17 Aug 2006 19:48:11 GMT (envelope-from jhb@freebsd.org) Date: Thu, 17 Aug 2006 19:48:11 GMT Message-Id: <200608171948.k7HJmBwq079493@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 104432 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2006 19:48:13 -0000 http://perforce.freebsd.org/chv.cgi?CH=104432 Change 104432 by jhb@jhb_mutex on 2006/08/17 19:47:48 During a LK_DRAIN, lockmgr() sleeps on &lkp->lk_flags rather than lkp, so add a check for that case. Affected files ... .. //depot/projects/smpng/sys/kern/kern_lock.c#55 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_lock.c#55 (text+ko) ==== @@ -602,9 +602,22 @@ 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) {