render / rpms / libvirt

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