Blame SOURCES/libvirt-qemu-blockjob-Actually-delete-temporary-bitmap-on-failed-active-commit.patch

79b470
From 2069251b1f50e1aaec566909478f1443ccfe32e6 Mon Sep 17 00:00:00 2001
79b470
Message-Id: <2069251b1f50e1aaec566909478f1443ccfe32e6@dist-git>
79b470
From: Peter Krempa <pkrempa@redhat.com>
79b470
Date: Tue, 21 Jul 2020 13:56:22 +0200
79b470
Subject: [PATCH] qemu: blockjob: Actually delete temporary bitmap on failed
79b470
 active commit
79b470
79b470
Commit 20a7abc2d2d tried to delete the possibly leftover bitmap but
79b470
neglected to call the actual monitor to do so.
79b470
79b470
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
79b470
Reviewed-by: Eric Blake <eblake@redhat.com>
79b470
(cherry picked from commit 378e4fbc795c607485799cbd060f34483f580544)
79b470
79b470
rhel-8.3: https://bugzilla.redhat.com/show_bug.cgi?id=1857779
79b470
rhel-av-8.2.1: not cloned yet
79b470
Message-Id: <add765f8f49b70dbfe1c2adf7e63e6e21b480c6d.1595332476.git.pkrempa@redhat.com>
79b470
79b470
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
79b470
---
79b470
 src/qemu/qemu_blockjob.c | 13 +++++++++++--
79b470
 1 file changed, 11 insertions(+), 2 deletions(-)
79b470
79b470
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
79b470
index 7e2df1445d..486fca31f3 100644
79b470
--- a/src/qemu/qemu_blockjob.c
79b470
+++ b/src/qemu/qemu_blockjob.c
79b470
@@ -1378,8 +1378,10 @@ qemuBlockJobProcessEventConcludedCopyAbort(virQEMUDriverPtr driver,
79b470
 static void
79b470
 qemuBlockJobProcessEventFailedActiveCommit(virQEMUDriverPtr driver,
79b470
                                            virDomainObjPtr vm,
79b470
-                                           qemuBlockJobDataPtr job)
79b470
+                                           qemuBlockJobDataPtr job,
79b470
+                                           qemuDomainAsyncJob asyncJob)
79b470
 {
79b470
+    qemuDomainObjPrivatePtr priv = vm->privateData;
79b470
     g_autoptr(virJSONValue) actions = virJSONValueNewArray();
79b470
     virDomainDiskDefPtr disk = job->disk;
79b470
 
79b470
@@ -1391,6 +1393,13 @@ qemuBlockJobProcessEventFailedActiveCommit(virQEMUDriverPtr driver,
79b470
     ignore_value(qemuMonitorTransactionBitmapRemove(actions, disk->mirror->nodeformat,
79b470
                                                     "libvirt-tmp-activewrite"));
79b470
 
79b470
+    if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0)
79b470
+        return;
79b470
+
79b470
+    qemuMonitorTransaction(priv->mon, &actions);
79b470
+
79b470
+    if (qemuDomainObjExitMonitor(priv->driver, vm) < 0)
79b470
+        return;
79b470
 
79b470
     /* Ideally, we would make the backing chain read only again (yes, SELinux
79b470
      * can do that using different labels). But that is not implemented yet and
79b470
@@ -1515,7 +1524,7 @@ qemuBlockJobEventProcessConcludedTransition(qemuBlockJobDataPtr job,
79b470
         if (success) {
79b470
             qemuBlockJobProcessEventCompletedActiveCommit(driver, vm, job, asyncJob);
79b470
         } else {
79b470
-            qemuBlockJobProcessEventFailedActiveCommit(driver, vm, job);
79b470
+            qemuBlockJobProcessEventFailedActiveCommit(driver, vm, job, asyncJob);
79b470
         }
79b470
         break;
79b470
 
79b470
-- 
79b470
2.27.0
79b470