From 97c59b9c46f915c48cd5db96ada40f060553bcae Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 14 Jul 2014 10:13:18 -0600 Subject: [PATCH] blockjob: wait for pivot to complete https://bugzilla.redhat.com/show_bug.cgi?id=1119173 documents that commit eaba79d was flawed in the implementation of the VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC flag when it comes to completing a blockcopy. Basically, the qemu pivot action is async (the QMP command returns immediately, but the user must wait for the BLOCK_JOB_COMPLETE event to know that all I/O related to the job has finally been flushed), but the libvirt command was documented as synchronous by default. As active block commit will also be using this code, it is worth fixing now. * src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Don't skip wait loop after pivot. Signed-off-by: Eric Blake --- src/qemu/qemu_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 62b7f079f4..1652744ed5 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14981,7 +14981,7 @@ qemuDomainBlockJobImpl(virDomainObjPtr vm, if (disk->mirror && mode == BLOCK_JOB_ABORT && (flags & VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT)) { ret = qemuDomainBlockPivot(conn, driver, vm, device, disk); - goto endjob; + goto waitjob; } if (base && @@ -15038,6 +15038,7 @@ qemuDomainBlockJobImpl(virDomainObjPtr vm, disk->mirroring = false; } + waitjob: /* With synchronous block cancel, we must synthesize an event, and * we silently ignore the ABORT_ASYNC flag. With asynchronous * block cancel, the event will come from qemu, but without the -- GitLab