Skip to content

Commit

Permalink
Merge remote-tracking branch 'bonzini/scsi-next' into staging
Browse files Browse the repository at this point in the history
* bonzini/scsi-next:
  scsi: Support TEST UNIT READY in the dummy LUN0
  block: add .bdrv_reopen_prepare() stub for iscsi
  virtio-scsi: Prevent assertion on missed events
  virtio-scsi: Cleanup of I/Os that never started
  scsi: Assign cancel_io vector for scsi_disk_emulate_ops

Conflicts:
	block/iscsi.c

aliguori: resolve trivial merge conflict in block/iscsi.c

Signed-off-by: Anthony Liguori <aliguori@amazon.com>
  • Loading branch information
Anthony Liguori committed Jan 24, 2014
2 parents 0d688cf + 1cb27d9 commit e9f526a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions block/iscsi.c
Expand Up @@ -1334,7 +1334,14 @@ static int iscsi_refresh_limits(BlockDriverState *bs)
bs->bl.opt_transfer_length = sector_lun2qemu(iscsilun->bl.opt_xfer_len,
iscsilun);
}
return 0;
}

/* We have nothing to do for iSCSI reopen, stub just returns
* success */
static int iscsi_reopen_prepare(BDRVReopenState *state,
BlockReopenQueue *queue, Error **errp)
{
return 0;
}

Expand Down Expand Up @@ -1446,6 +1453,7 @@ static BlockDriver bdrv_iscsi = {
.bdrv_close = iscsi_close,
.bdrv_create = iscsi_create,
.create_options = iscsi_create_options,
.bdrv_reopen_prepare = iscsi_reopen_prepare,

.bdrv_getlength = iscsi_getlength,
.bdrv_get_info = iscsi_get_info,
Expand Down
2 changes: 2 additions & 0 deletions hw/scsi/scsi-bus.c
Expand Up @@ -469,6 +469,8 @@ static int32_t scsi_target_send_command(SCSIRequest *req, uint8_t *buf)
r->req.dev->sense_is_ua = false;
}
break;
case TEST_UNIT_READY:
break;
default:
scsi_req_build_sense(req, SENSE_CODE(LUN_NOT_SUPPORTED));
scsi_req_complete(req, CHECK_CONDITION);
Expand Down
1 change: 1 addition & 0 deletions hw/scsi/scsi-disk.c
Expand Up @@ -2306,6 +2306,7 @@ static const SCSIReqOps scsi_disk_emulate_reqops = {
.send_command = scsi_disk_emulate_command,
.read_data = scsi_disk_emulate_read_data,
.write_data = scsi_disk_emulate_write_data,
.cancel_io = scsi_cancel_io,
.get_buf = scsi_get_buf,
};

Expand Down
6 changes: 5 additions & 1 deletion hw/scsi/virtio-scsi.c
Expand Up @@ -306,6 +306,10 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,
VirtIOSCSIReq *req = r->hba_private;
uint32_t sense_len;

if (r->io_canceled) {
return;
}

req->resp.cmd->response = VIRTIO_SCSI_S_OK;
req->resp.cmd->status = status;
if (req->resp.cmd->status == GOOD) {
Expand Down Expand Up @@ -516,7 +520,7 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
evt->event = event;
evt->reason = reason;
if (!dev) {
assert(event == VIRTIO_SCSI_T_NO_EVENT);
assert(event == VIRTIO_SCSI_T_EVENTS_MISSED);
} else {
evt->lun[0] = 1;
evt->lun[1] = dev->id;
Expand Down

0 comments on commit e9f526a

Please sign in to comment.