qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] replication: Avoid blk_make_empty() on read-only child


From: Kevin Wolf
Subject: [PATCH] replication: Avoid blk_make_empty() on read-only child
Date: Fri, 15 May 2020 14:03:18 +0200

This is just a bandaid to keep tests/test-replication working after
bdrv_make_empty() starts to assert that we're not trying to call it on a
read-only child.

For the real solution in the future, replication should not steal the
BdrvChild from its backing file (this is never correct to do!), but
instead have its own child node references, with the appropriate
permissions.

Signed-off-by: Kevin Wolf <address@hidden>
---
 block/replication.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/block/replication.c b/block/replication.c
index f1820ab1d0..ccf7b78160 100644
--- a/block/replication.c
+++ b/block/replication.c
@@ -343,7 +343,17 @@ static void secondary_do_checkpoint(BDRVReplicationState 
*s, Error **errp)
         return;
     }
 
-    ret = bdrv_make_empty(s->hidden_disk, errp);
+    BlockBackend *blk = blk_new(qemu_get_current_aio_context(),
+                                BLK_PERM_WRITE, BLK_PERM_ALL);
+    blk_insert_bs(blk, s->hidden_disk->bs, &local_err);
+    if (local_err) {
+        error_propagate(errp, local_err);
+        blk_unref(blk);
+        return;
+    }
+
+    ret = blk_make_empty(blk, errp);
+    blk_unref(blk);
     if (ret < 0) {
         return;
     }
-- 
2.25.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]