From b2c37a9f0e24e64026ec528ab4294d2b54858cd5 Mon Sep 17 00:00:00 2001 From: mav Date: Sat, 13 Oct 2012 18:24:52 +0000 Subject: Don't exclude XPT SIM from locking in xpt_create_path_unlocked(). We don't want xpt periph, device, target or bus disappeared because of incorrect reference counting. --- sys/cam/cam_xpt.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 046899c..6288390 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -3441,19 +3441,14 @@ xpt_create_path_unlocked(struct cam_path **new_path_ptr, struct cam_path *path; struct cam_eb *bus = NULL; cam_status status; - int need_unlock = 0; path = (struct cam_path *)malloc(sizeof(*path), M_CAMPATH, M_WAITOK); - if (path_id != CAM_BUS_WILDCARD) { - bus = xpt_find_bus(path_id); - if (bus != NULL) { - need_unlock = 1; - CAM_SIM_LOCK(bus->sim); - } - } + bus = xpt_find_bus(path_id); + if (bus != NULL) + CAM_SIM_LOCK(bus->sim); status = xpt_compile_path(path, periph, path_id, target_id, lun_id); - if (need_unlock) { + if (bus != NULL) { CAM_SIM_UNLOCK(bus->sim); xpt_release_bus(bus); } -- cgit v1.1