]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: block: Remove 'active-write' bitmap even if there are no bitmaps to merge
authorPeter Krempa <pkrempa@redhat.com>
Thu, 16 Jul 2020 12:46:43 +0000 (14:46 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 21 Jul 2020 07:52:59 +0000 (09:52 +0200)
The 'libvirt-tmp-activewrite' bitmap is added during the 'pivot'
operation of block copy and active layer block commit operations
regardless of whether there are any bitmaps to merge, but was not
removed unless a bitmap was merged. This meant that subsequent attempts
to merge into the same image would fail.

Fix it by checking whether the 'libvirt-tmp-activewrite' would be used
by the code and don't skip the code which would delete it.

This is a regression introduced when we switched to the new code for
block commit in <20a7abc2d2d> and for block copy in <7bfff40fdfe5>. The
actual bug originates from <4fa8654ece>.

https://bugzilla.redhat.com/show_bug.cgi?id=1857735

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
src/qemu/qemu_block.c
tests/qemublocktestdata/bitmapblockcommit/empty
tests/qemublocktestdata/bitmapblockcopy/empty-deep-out.json
tests/qemublocktestdata/bitmapblockcopy/empty-shallow-out.json

index d4ff37ced64884888c8c31173091b8f365d569fa..26c1b42428a7711410f102f98ce31e2db39d4175 100644 (file)
@@ -2981,7 +2981,7 @@ qemuBlockGetBitmapMergeActions(virStorageSourcePtr topsrc,
 
     if (!(bitmaps = qemuBlockGetBitmapMergeActionsGetBitmaps(topsrc, bitmapname,
                                                              blockNamedNodeData)))
-        return 0;
+        goto done;
 
     for (next = bitmaps; next; next = next->next) {
         const char *curbitmap = next->data;
@@ -3038,6 +3038,7 @@ qemuBlockGetBitmapMergeActions(virStorageSourcePtr topsrc,
             return -1;
     }
 
+ done:
     if (writebitmapsrc &&
         qemuMonitorTransactionBitmapRemove(act, writebitmapsrc->nodeformat,
                                            "libvirt-tmp-activewrite") < 0)
index 9260011852d0e115ec70bbb024d6ed3f7d94409b..eddef0ddcd6956d8c1e6a2a8b6778aeaf725446d 100644 (file)
@@ -1 +1,10 @@
 merge bitmpas:
+[
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-2-format",
+      "name": "libvirt-tmp-activewrite"
+    }
+  }
+]
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..99f2589ed4689255b37efcaef10961c6fe71ba6c 100644 (file)
@@ -0,0 +1,9 @@
+[
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "mirror-format-node",
+      "name": "libvirt-tmp-activewrite"
+    }
+  }
+]
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..99f2589ed4689255b37efcaef10961c6fe71ba6c 100644 (file)
@@ -0,0 +1,9 @@
+[
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "mirror-format-node",
+      "name": "libvirt-tmp-activewrite"
+    }
+  }
+]