Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Dec 2008 14:33:29 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r186320 - head/sys/cam
Message-ID:  <200812191433.mBJEXTbF074328@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Fri Dec 19 14:33:29 2008
New Revision: 186320
URL: http://svn.freebsd.org/changeset/base/186320

Log:
  Fix cam_sim_free() wakeup condition and add mtx_asserts.
  
  Submitted by:	Christoph Mallon
  Reviewed by:	scottl
  Approved by:	rwatson (mentor)
  Sponsored by:	FreeBSD Foundation

Modified:
  head/sys/cam/cam_sim.c

Modified: head/sys/cam/cam_sim.c
==============================================================================
--- head/sys/cam/cam_sim.c	Fri Dec 19 14:31:40 2008	(r186319)
+++ head/sys/cam/cam_sim.c	Fri Dec 19 14:33:29 2008	(r186320)
@@ -123,9 +123,10 @@ void
 cam_sim_release(struct cam_sim *sim)
 {
 	KASSERT(sim->refcount >= 1, ("sim->refcount >= 1"));
+	mtx_assert(sim->mtx, MA_OWNED);
 
 	sim->refcount--;
-	if (sim->refcount <= 1)
+	if (sim->refcount == 0)
 		wakeup(sim);
 }
 
@@ -133,6 +134,7 @@ void
 cam_sim_hold(struct cam_sim *sim)
 {
 	KASSERT(sim->refcount >= 1, ("sim->refcount >= 1"));
+	mtx_assert(sim->mtx, MA_OWNED);
 
 	sim->refcount++;
 }



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