summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2013-04-01 13:18:34 +0000
committermav <mav@FreeBSD.org>2013-04-01 13:18:34 +0000
commit4d67abd4923ada63de0b6f5985b35b2ae52bfbf1 (patch)
treed62c677abd248a8d5028a18c51a5489cc4981675
parent3b2ecc9e065ec4649e82a8190cda6249027a16d6 (diff)
downloadFreeBSD-src-4d67abd4923ada63de0b6f5985b35b2ae52bfbf1.zip
FreeBSD-src-4d67abd4923ada63de0b6f5985b35b2ae52bfbf1.tar.gz
Slightly tune locking to not call xpt_alloc_ccb() that is allowed to sleep
while holding the SIM mutex.
-rw-r--r--sys/dev/tws/tws_cam.c9
-rw-r--r--sys/dev/tws/tws_user.c2
2 files changed, 4 insertions, 7 deletions
diff --git a/sys/dev/tws/tws_cam.c b/sys/dev/tws/tws_cam.c
index 657777a..d988349 100644
--- a/sys/dev/tws/tws_cam.c
+++ b/sys/dev/tws/tws_cam.c
@@ -217,17 +217,16 @@ tws_bus_scan(struct tws_softc *sc)
TWS_TRACE_DEBUG(sc, "entry", sc, 0);
if (!(sc->sim))
return(ENXIO);
- mtx_assert(&sc->sim_lock, MA_OWNED);
- if ((ccb = xpt_alloc_ccb()) == NULL)
- return(ENOMEM);
-
+ ccb = xpt_alloc_ccb();
+ mtx_lock(&sc->sim_lock);
if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(sc->sim),
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
+ mtx_unlock(&sc->sim_lock);
xpt_free_ccb(ccb);
return(EIO);
}
xpt_rescan(ccb);
-
+ mtx_unlock(&sc->sim_lock);
return(0);
}
diff --git a/sys/dev/tws/tws_user.c b/sys/dev/tws/tws_user.c
index cbd03c9..223cc07 100644
--- a/sys/dev/tws/tws_user.c
+++ b/sys/dev/tws/tws_user.c
@@ -73,9 +73,7 @@ tws_ioctl(struct cdev *dev, u_long cmd, caddr_t buf, int flags,
break;
case TWS_IOCTL_SCAN_BUS :
TWS_TRACE_DEBUG(sc, "scan-bus", 0, 0);
- mtx_lock(&sc->sim_lock);
error = tws_bus_scan(sc);
- mtx_unlock(&sc->sim_lock);
break;
default :
TWS_TRACE_DEBUG(sc, "ioctl-aen", cmd, buf);
OpenPOWER on IntegriCloud