Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Mar 2011 17:04:45 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r219233 - stable/7/sys/kern
Message-ID:  <201103031704.p23H4jcf053845@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Thu Mar  3 17:04:45 2011
New Revision: 219233
URL: http://svn.freebsd.org/changeset/base/219233

Log:
  MFC 200761,218272:
  Always assert that the turnstile chain lock is held in turnstile_wait()
  and remove a duplicate hash lookup.

Modified:
  stable/7/sys/kern/subr_turnstile.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/kern/subr_turnstile.c
==============================================================================
--- stable/7/sys/kern/subr_turnstile.c	Thu Mar  3 16:59:20 2011	(r219232)
+++ stable/7/sys/kern/subr_turnstile.c	Thu Mar  3 17:04:45 2011	(r219233)
@@ -687,8 +687,8 @@ turnstile_wait(struct turnstile *ts, str
 	 * turnstile already in use by this lock.
 	 */
 	tc = TC_LOOKUP(ts->ts_lockobj);
-	if (ts == td->td_turnstile) {
 	mtx_assert(&tc->tc_lock, MA_OWNED);
+	if (ts == td->td_turnstile) {
 #ifdef TURNSTILE_PROFILING
 		tc->tc_depth++;
 		if (tc->tc_depth > tc->tc_max_depth) {
@@ -697,7 +697,6 @@ turnstile_wait(struct turnstile *ts, str
 				turnstile_max_depth = tc->tc_max_depth;
 		}
 #endif
-		tc = TC_LOOKUP(ts->ts_lockobj);
 		LIST_INSERT_HEAD(&tc->tc_turnstiles, ts, ts_hash);
 		KASSERT(TAILQ_EMPTY(&ts->ts_pending),
 		    ("thread's turnstile has pending threads"));



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