yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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