Slightly tune locking to not call xpt_alloc_ccb() that is allowed to sleep
while holding the SIM mutex.
This commit is contained in:
parent
f8992fccda
commit
b9e92e9853
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user