[PATCH 2/2] qemu: blockjob: Clean out disk mirror data after concluding the job

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux