[libvirt] [PATCH 3/5] qemuProcessStop: wake up pending sync block jobs

Michael Chapman mike at very.puzzling.org
Thu Apr 16 09:24:21 UTC 2015


Other threads may be blocked in qemuBlockJobSyncWait. Ensure that
they're woken up when the domain is stopped.

Signed-off-by: Michael Chapman <mike at very.puzzling.org>
---
 src/qemu/qemu_process.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 276837e..5390bc8 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5086,6 +5086,13 @@ void qemuProcessStop(virQEMUDriverPtr driver,
     if (virAtomicIntDecAndTest(&driver->nactive) && driver->inhibitCallback)
         driver->inhibitCallback(false, driver->inhibitOpaque);
 
+    /* Wake up anything waiting on synchronous block jobs */
+    for (i = 0; i < vm->def->ndisks; i++) {
+        virDomainDiskDefPtr disk = vm->def->disks[i];
+        if (disk->blockJobSync && disk->blockJobStatus == -1)
+            virCondSignal(&disk->blockJobSyncCond);
+    }
+
     if ((logfile = qemuDomainCreateLog(driver, vm, true)) < 0) {
         /* To not break the normal domain shutdown process, skip the
          * timestamp log writing if failed on opening log file. */
-- 
2.1.0




More information about the libvir-list mailing list