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

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