diff options
author | bryanv <bryanv@FreeBSD.org> | 2013-07-04 18:00:27 +0000 |
---|---|---|
committer | bryanv <bryanv@FreeBSD.org> | 2013-07-04 18:00:27 +0000 |
commit | 07bf5c56bffe08987c8c60f43587bd72a13cb0cd (patch) | |
tree | 1fd4ff89729e36daecb972fbee1733c90fa90e75 | |
parent | c07f9b1406dc341b897c83057d28907b8e2fc35f (diff) | |
download | FreeBSD-src-07bf5c56bffe08987c8c60f43587bd72a13cb0cd.zip FreeBSD-src-07bf5c56bffe08987c8c60f43587bd72a13cb0cd.tar.gz |
Merge virtio_scsi change from projects/virtio
r252680:
Fix SIM lock not owned panic
The CAM locking requirements of registering an async
callback has changed so the SIM lock must be held. Remove
code that explicitly dropped the lock around the register.
Also return CAM_SEL_TIMEOUT instead of CAM_TID_INVALID
for bad targets to avoid a lot console spam during bus
scans.
MFC after: 1 month
-rw-r--r-- | sys/dev/virtio/scsi/virtio_scsi.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/sys/dev/virtio/scsi/virtio_scsi.c b/sys/dev/virtio/scsi/virtio_scsi.c index 64aa62d..e5f922b 100644 --- a/sys/dev/virtio/scsi/virtio_scsi.c +++ b/sys/dev/virtio/scsi/virtio_scsi.c @@ -542,19 +542,14 @@ vtscsi_register_cam(struct vtscsi_softc *sc) goto fail; } - VTSCSI_UNLOCK(sc); - - /* - * The async register apparently needs to be done without - * the lock held, otherwise it can recurse on the lock. - */ if (vtscsi_register_async(sc) != CAM_REQ_CMP) { error = EIO; device_printf(dev, "cannot register async callback\n"); - VTSCSI_LOCK(sc); goto fail; } + VTSCSI_UNLOCK(sc); + return (0); fail: @@ -622,8 +617,6 @@ vtscsi_register_async(struct vtscsi_softc *sc) { struct ccb_setasync csa; - VTSCSI_LOCK_NOTOWNED(sc); - xpt_setup_ccb(&csa.ccb_h, sc->vtscsi_path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_LOST_DEVICE | AC_FOUND_DEVICE; @@ -1238,7 +1231,7 @@ vtscsi_scsi_cmd_cam_status(struct virtio_scsi_cmd_resp *cmd_resp) status = CAM_REQ_ABORTED; break; case VIRTIO_SCSI_S_BAD_TARGET: - status = CAM_TID_INVALID; + status = CAM_SEL_TIMEOUT; break; case VIRTIO_SCSI_S_RESET: status = CAM_SCSI_BUS_RESET; |