[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/51] replication: Avoid blk_make_empty() on read-only child
From: |
Kevin Wolf |
Subject: |
[PULL 11/51] replication: Avoid blk_make_empty() on read-only child |
Date: |
Fri, 15 May 2020 14:44:41 +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 | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/block/replication.c b/block/replication.c
index c03980a192..eb480a8e08 100644
--- a/block/replication.c
+++ b/block/replication.c
@@ -343,9 +343,18 @@ static void secondary_do_checkpoint(BDRVReplicationState
*s, Error **errp)
return;
}
- ret = s->hidden_disk->bs->drv->bdrv_make_empty(s->hidden_disk->bs);
+ 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) {
- error_setg(errp, "Cannot make hidden disk empty");
return;
}
}
--
2.25.4
- [PULL 02/51] iotests/229: Use blkdebug to inject an error, (continued)
- [PULL 02/51] iotests/229: Use blkdebug to inject an error, Kevin Wolf, 2020/05/15
- [PULL 03/51] mirror: Make sure that source and target size match, Kevin Wolf, 2020/05/15
- [PULL 05/51] block/replication.c: Avoid cancelling the job twice, Kevin Wolf, 2020/05/15
- [PULL 04/51] iotests: Mirror with different source/target size, Kevin Wolf, 2020/05/15
- [PULL 06/51] iotests: Fix incomplete type declarations, Kevin Wolf, 2020/05/15
- [PULL 08/51] block: Add bdrv_make_empty(), Kevin Wolf, 2020/05/15
- [PULL 09/51] block: Add blk_make_empty(), Kevin Wolf, 2020/05/15
- [PULL 10/51] block: Use blk_make_empty() after commits, Kevin Wolf, 2020/05/15
- [PULL 12/51] block: Use bdrv_make_empty() where possible, Kevin Wolf, 2020/05/15
- [PULL 07/51] iotests: Run pylint and mypy in a testcase, Kevin Wolf, 2020/05/15
- [PULL 11/51] replication: Avoid blk_make_empty() on read-only child,
Kevin Wolf <=
- [PULL 13/51] block: Mark commit, mirror, blkreplay as filters, Kevin Wolf, 2020/05/15
- [PULL 15/51] block: Rename BdrvChildRole to BdrvChildClass, Kevin Wolf, 2020/05/15
- [PULL 16/51] block: Add BdrvChildRole and BdrvChildRoleBits, Kevin Wolf, 2020/05/15
- [PULL 17/51] block: Add BdrvChildRole to BdrvChild, Kevin Wolf, 2020/05/15
- [PULL 19/51] block: Pass BdrvChildRole to .inherit_options(), Kevin Wolf, 2020/05/15
- [PULL 14/51] block: Add BlockDriver.is_format, Kevin Wolf, 2020/05/15
- [PULL 22/51] block: Add generic bdrv_inherited_options(), Kevin Wolf, 2020/05/15
- [PULL 23/51] block: Use bdrv_inherited_options(), Kevin Wolf, 2020/05/15
- [PULL 20/51] block: Pass parent_is_format to .inherit_options(), Kevin Wolf, 2020/05/15
- [PULL 18/51] block: Pass BdrvChildRole to bdrv_child_perm(), Kevin Wolf, 2020/05/15