[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH] virtio-scsi: Report BAD_TARGET if device is not av
From: |
Fam Zheng |
Subject: |
[Qemu-stable] [PATCH] virtio-scsi: Report BAD_TARGET if device is not available |
Date: |
Mon, 12 Sep 2016 09:48:04 +0800 |
Ejected devices cannot complete the IO, so we can fail it early.
This is also a fix to a crash for dataplane in that case, since the
assert(blk_get_aio_context(d->conf.blk) == s->ctx);
below won't hold because blk_get_aio_context will return qemu_aio_ctx
for ejected devices, where as s->ctx is the assigned IOThread ctx.
Cc: address@hidden
Signed-off-by: Fam Zheng <address@hidden>
---
hw/scsi/virtio-scsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index ce57ef6..5376e46 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -534,7 +534,7 @@ static bool virtio_scsi_handle_cmd_req_prepare(VirtIOSCSI
*s, VirtIOSCSIReq *req
}
d = virtio_scsi_device_find(s, req->req.cmd.lun);
- if (!d) {
+ if (!d || !blk_is_available(d->conf.blk)) {
req->resp.cmd.response = VIRTIO_SCSI_S_BAD_TARGET;
virtio_scsi_complete_cmd_req(req);
return false;
--
2.7.4
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-stable] [PATCH] virtio-scsi: Report BAD_TARGET if device is not available,
Fam Zheng <=