aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/cam_sim.c
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2008-12-19 14:33:29 +0000
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2008-12-19 14:33:29 +0000
commit7412d60d0b7624d6f25ee15654b5d20887ebcd11 (patch)
tree54d50808fb43d1ba6e5fe184ccfc2b6112150959 /sys/cam/cam_sim.c
parent24ebf566361c2ccb092a24caa3564bb2ebd20a10 (diff)
downloadsrc-7412d60d0b7624d6f25ee15654b5d20887ebcd11.tar.gz
src-7412d60d0b7624d6f25ee15654b5d20887ebcd11.zip
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
Notes
Notes: svn path=/head/; revision=186320
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 d7fcaad1afa7..adccfa8593ec 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++;
}