]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuProcessStop: wake up pending sync block jobs
authorMichael Chapman <mike@very.puzzling.org>
Thu, 16 Apr 2015 09:24:21 +0000 (19:24 +1000)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 29 Apr 2015 11:11:42 +0000 (13:11 +0200)
Other threads may be blocked in qemuBlockJobSyncWait. Ensure that
they're woken up when the domain is stopped.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
src/qemu/qemu_process.c

index 605b3c62d04823316f93a96acd739fdab24827f8..56719ebe95333517c7fe99ca20d59d7ed4db7e00 100644 (file)
@@ -5061,6 +5061,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. */