The 'disk->mirrorJob' and 'disk->mirrorState' fields need to be
cleared
after a blockjob, but should be kept around while 'disk->mirror' is
still in place. As 'disk->mirror' is cleared only after conclusion of
the job in 'qemuBlockJobEventProcessConcluded()' we should be resetting
them only afterwards.
Move the code later, but since the job is unregistered from the disk we
need to store the pointer to the disk before concluding the job.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_blockjob.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 9c56d5cb95..652b25540a 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -1561,12 +1561,18 @@ qemuBlockJobEventProcess(virQEMUDriver *driver,
case QEMU_BLOCKJOB_STATE_COMPLETED:
case QEMU_BLOCKJOB_STATE_FAILED:
case QEMU_BLOCKJOB_STATE_CANCELLED:
- case QEMU_BLOCKJOB_STATE_CONCLUDED:
- if (job->disk) {
- job->disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE;
- job->disk->mirrorJob = VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN;
- }
+ case QEMU_BLOCKJOB_STATE_CONCLUDED: {
+ virDomainDiskDef *disk = job->disk;
+
qemuBlockJobEventProcessConcluded(job, driver, vm, asyncJob);
+
+ /* Job was unregistered from the disk but we must ensure that the
+ * data is cleared */
+ if (disk) {
+ disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE;
+ disk->mirrorJob = VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN;
+ }
+ }
break;
case QEMU_BLOCKJOB_STATE_READY:
--
2.46.0