From: Peter Krempa Date: Fri, 17 Aug 2018 07:11:34 +0000 (+0200) Subject: qemu: hotplug: Fix asynchronous unplug of 'shmem' X-Git-Tag: v4.7.0-rc1~121 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69c20e1090059d8b359fdd435e8ba50db7269be1;p=thirdparty%2Flibvirt.git qemu: hotplug: Fix asynchronous unplug of 'shmem' 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 --- diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 5b52fe9edc..fa490c53e1 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -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; }