svn commit: r186320 - head/sys/cam

Edward Tomasz Napierala trasz at FreeBSD.org
Fri Dec 19 14:33:30 UTC 2008


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++;
 }


More information about the svn-src-head mailing list