thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/0017-virtio-scsi-Reject-scsi-cd-if-data-plane-enabled-RHE.patch

60061b
From d95768c039a2bf6b68422f83a8d55dad41bd3181 Mon Sep 17 00:00:00 2001
26ba25
From: Fam Zheng <famz@redhat.com>
26ba25
Date: Wed, 14 Jun 2017 15:37:01 +0200
26ba25
Subject: virtio-scsi: Reject scsi-cd if data plane enabled [RHEL only]
26ba25
26ba25
RH-Author: Fam Zheng <famz@redhat.com>
26ba25
Message-id: <20170614153701.14757-1-famz@redhat.com>
26ba25
Patchwork-id: 75613
26ba25
O-Subject: [RHV-7.4 qemu-kvm-rhev PATCH v3] virtio-scsi: Reject scsi-cd if data plane enabled [RHEL only]
26ba25
Bugzilla: 1378816
26ba25
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
26ba25
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
26ba25
RH-Acked-by: Max Reitz <mreitz@redhat.com>
26ba25
26ba25
We need a fix for RHEL 7.4 and 7.3.z, but unfortunately upstream isn't
26ba25
ready. If it were, the changes will be too invasive. To have an idea:
26ba25
26ba25
https://lists.gnu.org/archive/html/qemu-devel/2017-05/msg05400.html
26ba25
26ba25
is an incomplete attempt to fix part of the issue, and the remaining
26ba25
work unfortunately involve even more complex changes.
26ba25
26ba25
As a band-aid, this partially reverts the effect of ef8875b
26ba25
(virtio-scsi: Remove op blocker for dataplane, since v2.7). We cannot
26ba25
simply revert that commit as a whole because we already shipped it in
26ba25
qemu-kvm-rhev 7.3, since when, block jobs has been possible.  We should
26ba25
only block what has been broken.  Also, faithfully reverting the above
26ba25
commit means adding back the removed op blocker, but that is not enough,
26ba25
because it still crashes when inserting media into an initially empty
26ba25
scsi-cd.
26ba25
26ba25
All in all, scsi-cd on virtio-scsi-dataplane has basically been unusable
26ba25
unless the scsi-cd never enters an empty state, so, disable it
26ba25
altogether.  Otherwise it would be much more difficult to avoid
26ba25
crashing.
26ba25
26ba25
Signed-off-by: Fam Zheng <famz@redhat.com>
26ba25
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 hw/scsi/virtio-scsi.c | 9 +++++++++
26ba25
 1 file changed, 9 insertions(+)
26ba25
26ba25
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
60061b
index 51fd09522a..a35257c35a 100644
26ba25
--- a/hw/scsi/virtio-scsi.c
26ba25
+++ b/hw/scsi/virtio-scsi.c
60061b
@@ -896,6 +896,15 @@ static void virtio_scsi_hotplug(HotplugHandler *hotplug_dev, DeviceState *dev,
60061b
     AioContext *old_context;
902636
     int ret;
26ba25
 
26ba25
+    /* XXX: Remove this check once block backend is capable of handling
26ba25
+     * AioContext change upon eject/insert.
26ba25
+     * s->ctx is NULL if ioeventfd is off, s->ctx is qemu_get_aio_context() if
26ba25
+     * data plane is not used, both cases are safe for scsi-cd. */
26ba25
+    if (s->ctx && s->ctx != qemu_get_aio_context() &&
26ba25
+        object_dynamic_cast(OBJECT(dev), "scsi-cd")) {
26ba25
+        error_setg(errp, "scsi-cd is not supported by data plane");
26ba25
+        return;
26ba25
+    }
26ba25
     if (s->ctx && !s->dataplane_fenced) {
26ba25
         if (blk_op_is_blocked(sd->conf.blk, BLOCK_OP_TYPE_DATAPLANE, errp)) {
26ba25
             return;
26ba25
-- 
60061b
2.27.0
26ba25