]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: blockjob: Fix deadlock when terminating job with invalid data
authorPeter Krempa <pkrempa@redhat.com>
Tue, 26 Nov 2019 12:16:36 +0000 (13:16 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 27 Nov 2019 14:59:33 +0000 (15:59 +0100)
We must exit the monitor prior to refusing other work, otherwise the VM
object will become unusable.

This bug was introduced in commit v5.5.0-244-gc412383796 but thankfully
the code path was not excercised without QEMU_CAPS_BLOCKDEV.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
src/qemu/qemu_blockjob.c

index 2283d49c616a4f4fccebd7abd183d1bbf5f807db..818e36435c1ec3c4570e2cd77275caf94d0a4306 100644 (file)
@@ -1305,14 +1305,14 @@ qemuBlockJobEventProcessConcluded(qemuBlockJobDataPtr job,
             dismissed = true;
     }
 
+    if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
+        goto cleanup;
+
     if (job->invalidData) {
         VIR_WARN("terminating job '%s' with invalid data", job->name);
         goto cleanup;
     }
 
-    if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
-        goto cleanup;
-
     if ((job->newstate == QEMU_BLOCKJOB_STATE_COMPLETED ||
          job->newstate == QEMU_BLOCKJOB_STATE_FAILED) &&
         job->state == QEMU_BLOCKJOB_STATE_ABORTING)