]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: process: Don't use qemuBlockJobStartupFinalize in qemuProcessHandleBlockJob
authorPeter Krempa <pkrempa@redhat.com>
Thu, 18 Jul 2019 16:08:11 +0000 (18:08 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 19 Jul 2019 13:49:40 +0000 (15:49 +0200)
The block job event handler qemuProcessHandleBlockJob looks at the block
job data to see whether the job requires synchronous handling. Since the
block job event may arrive before we continue the job handling (if the
job has no data to copy) we could hit the state when the job is still
set as QEMU_BLOCKJOB_STATE_NEW (as we move it to the
QEMU_BLOCKJOB_STATE_RUNNING state only after returning from monitor).

If the event handler uses qemuBlockJobStartupFinalize it would
unregister and free the job. Thankfully this is not a big problem for
legacy blockjobs as we don't need much data for them but since we'd
re-instantiate the job data structure we'd report wrong job type for
active commit as qemu reports it as a regular commit job.

Fix it by not using qemuBlockJobStartupFinalize function in
qemuProcessHandleBlockJob as it is not starting the job anyways.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_process.c

index f3ffd76259fe8446d7bd15770e5e04e3c78b6c73..75205bc121c8007982d136fbd49f6268ebb5167a 100644 (file)
@@ -936,7 +936,7 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     virQEMUDriverPtr driver = opaque;
     struct qemuProcessEvent *processEvent = NULL;
     virDomainDiskDefPtr disk;
-    qemuBlockJobDataPtr job = NULL;
+    VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL;
     char *data = NULL;
 
     virObjectLock(vm);
@@ -983,7 +983,6 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     }
 
  cleanup:
-    qemuBlockJobStartupFinalize(vm, job);
     qemuProcessEventFree(processEvent);
     virObjectUnlock(vm);
     return 0;