qemu: blockjob: Clean out disk mirror data after concluding the job

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@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Peter Krempa 2024-09-27 09:07:22 +02:00
parent b85b60d140
commit 54109db826

View File

@ -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: