render / rpms / libvirt

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