[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 25/25] virtio-scsi: Don't abort when media is ejecte
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 25/25] virtio-scsi: Don't abort when media is ejected |
Date: |
Tue, 20 Sep 2016 12:05:41 -0500 |
From: Fam Zheng <address@hidden>
With an ejected block backend, blk_get_aio_context() would return
qemu_aio_context. In this case don't assert.
Signed-off-by: Fam Zheng <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
(cherry picked from commit 2a2d69f490c1b1dc6b6d2aef385ee7b654497a77)
Signed-off-by: Michael Roth <address@hidden>
---
hw/scsi/virtio-scsi.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 30415c6..f4eff4d 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -236,6 +236,13 @@ static void virtio_scsi_cancel_notify(Notifier *notifier,
void *data)
g_free(n);
}
+static inline void virtio_scsi_ctx_check(VirtIOSCSI *s, SCSIDevice *d)
+{
+ if (s->dataplane_started && d && blk_is_available(d->conf.blk)) {
+ assert(blk_get_aio_context(d->conf.blk) == s->ctx);
+ }
+}
+
/* Return 0 if the request is ready to be completed and return to guest;
* -EINPROGRESS if the request is submitted and will be completed later, in the
* case of async cancellation. */
@@ -247,9 +254,7 @@ static int virtio_scsi_do_tmf(VirtIOSCSI *s, VirtIOSCSIReq
*req)
int target;
int ret = 0;
- if (s->dataplane_started && d) {
- assert(blk_get_aio_context(d->conf.blk) == s->ctx);
- }
+ virtio_scsi_ctx_check(s, d);
/* Here VIRTIO_SCSI_S_OK means "FUNCTION COMPLETE". */
req->resp.tmf.response = VIRTIO_SCSI_S_OK;
@@ -539,9 +544,7 @@ static bool virtio_scsi_handle_cmd_req_prepare(VirtIOSCSI
*s, VirtIOSCSIReq *req
virtio_scsi_complete_cmd_req(req);
return false;
}
- if (s->dataplane_started) {
- assert(blk_get_aio_context(d->conf.blk) == s->ctx);
- }
+ virtio_scsi_ctx_check(s, d);
req->sreq = scsi_req_new(d, req->req.cmd.tag,
virtio_scsi_get_lun(req->req.cmd.lun),
req->req.cmd.cdb, req);
--
1.9.1
- [Qemu-devel] [PATCH 20/25] scsi: mptconfig: fix an assert expression, (continued)
- [Qemu-devel] [PATCH 20/25] scsi: mptconfig: fix an assert expression, Michael Roth, 2016/09/20
- [Qemu-devel] [PATCH 02/25] ui: fix refresh of VNC server surface, Michael Roth, 2016/09/20
- [Qemu-devel] [PATCH 19/25] vmw_pvscsi: check page count while initialising descriptor rings, Michael Roth, 2016/09/20
- [Qemu-devel] [PATCH 03/25] virtio: recalculate vq->inuse after migration, Michael Roth, 2016/09/20
- [Qemu-devel] [PATCH 21/25] scsi: mptconfig: fix misuse of MPTSAS_CONFIG_PACK, Michael Roth, 2016/09/20
- [Qemu-devel] [PATCH 24/25] scsi-disk: Cleaning up around tray open state, Michael Roth, 2016/09/20
- [Qemu-devel] [PATCH 08/25] 9pfs: forbid illegal path names, Michael Roth, 2016/09/20
- [Qemu-devel] [PATCH 07/25] net: vmxnet: use g_new for pkt initialisation, Michael Roth, 2016/09/20
- [Qemu-devel] [PATCH 04/25] virtio: decrement vq->inuse in virtqueue_discard(), Michael Roth, 2016/09/20
- [Qemu-devel] [PATCH 06/25] net: vmxnet: check IP header length, Michael Roth, 2016/09/20
- [Qemu-devel] [PATCH 25/25] virtio-scsi: Don't abort when media is ejected,
Michael Roth <=
- [Qemu-devel] [PATCH 23/25] iothread: Stop threads before main() quits, Michael Roth, 2016/09/20
- [Qemu-devel] [PATCH 05/25] iscsi: pass SCSI status back for SG_IO, Michael Roth, 2016/09/20
- [Qemu-devel] [PATCH 01/25] net: check fragment length during fragmentation, Michael Roth, 2016/09/20
- Re: [Qemu-devel] [PATCH 00/25] Patch Round-up for stable 2.6.2, freeze on 2016-08-26, Eric Blake, 2016/09/20
- Re: [Qemu-devel] [Qemu-stable] [PATCH 00/25] Patch Round-up for stable 2.6.2, freeze on 2016-08-26, Michael Roth, 2016/09/20
- Re: [Qemu-devel] [PATCH 00/25] Patch Round-up for stable 2.6.2, freeze on 2016-08-26, John Snow, 2016/09/22