Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Aug 2006 19:48:11 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 104432 for review
Message-ID:  <200608171948.k7HJmBwq079493@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608171948.k7HJmBwq079493>