summaryrefslogtreecommitdiffstats
path: root/sys/cam/cam_xpt.c
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2008-12-16 16:57:33 +0000
committertrasz <trasz@FreeBSD.org>2008-12-16 16:57:33 +0000
commit1aa4ea9cfb2dc8da2c82c6b4f27eee1e40c731be (patch)
tree4b0fd6e2cd5eb30999a8168d4c935eca7d284ac6 /sys/cam/cam_xpt.c
parentebb77f64c32720fd23b448d19863ad50894b7919 (diff)
downloadFreeBSD-src-1aa4ea9cfb2dc8da2c82c6b4f27eee1e40c731be.zip
FreeBSD-src-1aa4ea9cfb2dc8da2c82c6b4f27eee1e40c731be.tar.gz
Add SIM refcounting. This is slightly different from what DragonFly
does - in DragonFly, it's cam_sim_release() what actually frees the SIM; cam_sim_free does nothing more than calling cam_sim_release(). Here, we drain in cam_sim_free, waiting for refcount to drop to zero. We cannot do the same think DragonFly does, because after cam_sim_free returns, client would destroy the sim->mtx, and CAM would trip over an initialized mutex. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation
Diffstat (limited to 'sys/cam/cam_xpt.c')
-rw-r--r--sys/cam/cam_xpt.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index 60bfb99..cf3fa2c 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -4304,6 +4304,7 @@ xpt_bus_register(struct cam_sim *sim, device_t parent, u_int32_t bus)
TAILQ_INIT(&new_bus->et_entries);
new_bus->path_id = sim->path_id;
+ cam_sim_hold(sim);
new_bus->sim = sim;
timevalclear(&new_bus->last_reset);
new_bus->flags = 0;
@@ -4846,6 +4847,7 @@ xpt_release_bus(struct cam_eb *bus)
TAILQ_REMOVE(&xsoftc.xpt_busses, bus, links);
xsoftc.bus_generation++;
mtx_unlock(&xsoftc.xpt_topo_lock);
+ cam_sim_release(bus->sim);
free(bus, M_CAMXPT);
}
}
OpenPOWER on IntegriCloud