render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
edecca
From b6b3d9d21c2b4a3587c5d85b3fef6c6193730d69 Mon Sep 17 00:00:00 2001
edecca
Message-Id: <b6b3d9d21c2b4a3587c5d85b3fef6c6193730d69@dist-git>
edecca
From: Peter Krempa <pkrempa@redhat.com>
edecca
Date: Fri, 17 Aug 2018 12:05:13 +0200
edecca
Subject: [PATCH] qemu: hotplug: Fix asynchronous unplug of 'shmem'
edecca
edecca
commit 5c81c342a7 forgot to skip the detaching of the shmem backend
edecca
when async unplug is requested which meant that we've tried to unplug
edecca
the backend prior to delivery of the DEVICE_DELETED event.
edecca
edecca
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1618622
edecca
edecca
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
edecca
(cherry picked from commit 69c20e1090059d8b359fdd435e8ba50db7269be1)
edecca
https: //bugzilla.redhat.com/show_bug.cgi?id=1618680
edecca
Reviewed-by: Erik Skultety <eskultet@redhat.com>
edecca
---
edecca
 src/qemu/qemu_hotplug.c | 11 ++++++++---
edecca
 1 file changed, 8 insertions(+), 3 deletions(-)
edecca
edecca
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
edecca
index 053ddb14ec..397a2bdde2 100644
edecca
--- a/src/qemu/qemu_hotplug.c
edecca
+++ b/src/qemu/qemu_hotplug.c
edecca
@@ -5262,11 +5262,16 @@ qemuDomainDetachShmemDevice(virQEMUDriverPtr driver,
edecca
     if (qemuDomainObjExitMonitor(driver, vm) < 0)
edecca
         goto cleanup;
edecca
 
edecca
-    if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1)
edecca
-        ret = qemuDomainRemoveShmemDevice(driver, vm, shmem);
edecca
+    if (async) {
edecca
+        ret = 0;
edecca
+    } else {
edecca
+        if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1)
edecca
+            ret = qemuDomainRemoveShmemDevice(driver, vm, shmem);
edecca
+    }
edecca
 
edecca
  cleanup:
edecca
-    qemuDomainResetDeviceRemoval(vm);
edecca
+    if (!async)
edecca
+        qemuDomainResetDeviceRemoval(vm);
edecca
     return ret;
edecca
 }
edecca
 
edecca
-- 
edecca
2.18.0
edecca