summaryrefslogtreecommitdiffstats
path: root/sys/cam/cam_sim.c
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2008-12-19 14:33:29 +0000
committertrasz <trasz@FreeBSD.org>2008-12-19 14:33:29 +0000
commit2cd9ec8ad6fc36ea0d3e91db131b87518c88b45a (patch)
tree54d50808fb43d1ba6e5fe184ccfc2b6112150959 /sys/cam/cam_sim.c
parentd19b8615b7a3619d21808b172b2dc9739498d198 (diff)
downloadFreeBSD-src-2cd9ec8ad6fc36ea0d3e91db131b87518c88b45a.zip
FreeBSD-src-2cd9ec8ad6fc36ea0d3e91db131b87518c88b45a.tar.gz
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
Diffstat (limited to 'sys/cam/cam_sim.c')
-rw-r--r--sys/cam/cam_sim.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/cam/cam_sim.c b/sys/cam/cam_sim.c
index d7fcaad..adccfa8 100644
--- a/sys/cam/cam_sim.c
+++ b/sys/cam/cam_sim.c
@@ -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++;
}
OpenPOWER on IntegriCloud