]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: hotplug: Fix asynchronous unplug of 'shmem'
authorPeter Krempa <pkrempa@redhat.com>
Fri, 17 Aug 2018 07:11:34 +0000 (09:11 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 17 Aug 2018 07:14:02 +0000 (09:14 +0200)
commit 5c81c342a7 forgot to skip the detaching of the shmem backend
when async unplug is requested which meant that we've tried to unplug
the backend prior to delivery of the DEVICE_DELETED event.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1618622

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_hotplug.c

index 5b52fe9edc942f9b6811d010df7bdf8c57a4e497..fa490c53e129bcfb0c7b325de84e0592c40a69b8 100644 (file)
@@ -5479,11 +5479,16 @@ qemuDomainDetachShmemDevice(virQEMUDriverPtr driver,
     if (qemuDomainObjExitMonitor(driver, vm) < 0)
         goto cleanup;
 
-    if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1)
-        ret = qemuDomainRemoveShmemDevice(driver, vm, shmem);
+    if (async) {
+        ret = 0;
+    } else {
+        if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1)
+            ret = qemuDomainRemoveShmemDevice(driver, vm, shmem);
+    }
 
  cleanup:
-    qemuDomainResetDeviceRemoval(vm);
+    if (!async)
+        qemuDomainResetDeviceRemoval(vm);
     return ret;
 }