cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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