Blame SOURCES/libvirt-qemuBackupDiskDataCleanupOne-Don-t-exit-early-when-the-job-has-started.patch

fbe740
From 9dee5f450fba6b084aaef5a46b112942e6efd913 Mon Sep 17 00:00:00 2001
fbe740
Message-Id: <9dee5f450fba6b084aaef5a46b112942e6efd913@dist-git>
fbe740
From: Peter Krempa <pkrempa@redhat.com>
fbe740
Date: Tue, 23 Jun 2020 12:24:10 +0200
fbe740
Subject: [PATCH] qemuBackupDiskDataCleanupOne: Don't exit early when the job
fbe740
 has started
fbe740
MIME-Version: 1.0
fbe740
Content-Type: text/plain; charset=UTF-8
fbe740
Content-Transfer-Encoding: 8bit
fbe740
fbe740
Originally the function was cleaning up a failed job only but now
fbe740
there's other stuff that needs to be cleared too.
fbe740
fbe740
Make only steps which clean up after a failed job depend on the
fbe740
'started' field and execute the rest of the code always.
fbe740
fbe740
This fixes a leak of the backup job tracking object and the blockdev-add
fbe740
helper data.
fbe740
fbe740
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
fbe740
Reviewed-by: Ján Tomko <jtomko@redhat.com>
fbe740
(cherry picked from commit 165b430eb9a1213ef32f14ace14d8377e9e71446)
fbe740
https://bugzilla.redhat.com/show_bug.cgi?id=1804593
fbe740
Message-Id: <2cd881ed2059b64293b32b42fbe942cc2e147f81.1592906423.git.pkrempa@redhat.com>
fbe740
Reviewed-by: Ján Tomko <jtomko@redhat.com>
fbe740
---
fbe740
 src/qemu/qemu_backup.c | 25 ++++++++++++-------------
fbe740
 1 file changed, 12 insertions(+), 13 deletions(-)
fbe740
fbe740
diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c
fbe740
index fdc75d3160..c68227f029 100644
fbe740
--- a/src/qemu/qemu_backup.c
fbe740
+++ b/src/qemu/qemu_backup.c
fbe740
@@ -124,26 +124,25 @@ qemuBackupDiskDataCleanupOne(virDomainObjPtr vm,
fbe740
 {
fbe740
     qemuDomainObjPrivatePtr priv = vm->privateData;
fbe740
 
fbe740
-    if (dd->started)
fbe740
-        return;
fbe740
+    if (!dd->started) {
fbe740
+        if (dd->added) {
fbe740
+            qemuDomainObjEnterMonitor(priv->driver, vm);
fbe740
+            qemuBlockStorageSourceAttachRollback(priv->mon, dd->crdata->srcdata[0]);
fbe740
+            ignore_value(qemuDomainObjExitMonitor(priv->driver, vm));
fbe740
+        }
fbe740
 
fbe740
-    if (dd->added) {
fbe740
-        qemuDomainObjEnterMonitor(priv->driver, vm);
fbe740
-        qemuBlockStorageSourceAttachRollback(priv->mon, dd->crdata->srcdata[0]);
fbe740
-        ignore_value(qemuDomainObjExitMonitor(priv->driver, vm));
fbe740
-    }
fbe740
+        if (dd->created) {
fbe740
+            if (virStorageFileUnlink(dd->store) < 0)
fbe740
+                VIR_WARN("Unable to remove just-created %s", NULLSTR(dd->store->path));
fbe740
+        }
fbe740
 
fbe740
-    if (dd->created) {
fbe740
-        if (virStorageFileUnlink(dd->store) < 0)
fbe740
-            VIR_WARN("Unable to remove just-created %s", NULLSTR(dd->store->path));
fbe740
+        if (dd->labelled)
fbe740
+            qemuDomainStorageSourceAccessRevoke(priv->driver, vm, dd->store);
fbe740
     }
fbe740
 
fbe740
     if (dd->initialized)
fbe740
         virStorageFileDeinit(dd->store);
fbe740
 
fbe740
-    if (dd->labelled)
fbe740
-        qemuDomainStorageSourceAccessRevoke(priv->driver, vm, dd->store);
fbe740
-
fbe740
     if (dd->blockjob)
fbe740
         qemuBlockJobStartupFinalize(vm, dd->blockjob);
fbe740
 
fbe740
-- 
fbe740
2.27.0
fbe740