[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/24] block: bdrv_reopen_parse_backing(): don't check frozen chil
From: |
Kevin Wolf |
Subject: |
[PULL 09/24] block: bdrv_reopen_parse_backing(): don't check frozen child |
Date: |
Wed, 30 Jun 2021 18:01:51 +0200 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
bdrv_set_backing_noperm() takes care of it (actual check is in
bdrv_set_file_or_backing_noperm()), so we don't need to check it here.
While being here, improve error message a bit.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20210610120537.196183-5-vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block.c | 14 +-------------
tests/qemu-iotests/245 | 8 ++++----
2 files changed, 5 insertions(+), 17 deletions(-)
diff --git a/block.c b/block.c
index 69dc9d188d..6472866283 100644
--- a/block.c
+++ b/block.c
@@ -4308,19 +4308,7 @@ static int bdrv_reopen_parse_backing(BDRVReopenState
*reopen_state,
"an implicit backing file", bs->node_name);
return -EPERM;
}
- /*
- * Check if the backing link that we want to replace is frozen.
- * Note that
- * bdrv_filter_or_cow_child(overlay_bs) == overlay_bs->backing,
- * because we know that overlay_bs == bs, and that @bs
- * either is a filter that uses ->backing or a COW format BDS
- * with bs->drv->supports_backing == true.
- */
- if (bdrv_is_backing_chain_frozen(overlay_bs,
- child_bs(overlay_bs->backing), errp))
- {
- return -EPERM;
- }
+
reopen_state->replace_backing_bs = true;
reopen_state->old_backing_bs = bs->backing ? bs->backing->bs : NULL;
ret = bdrv_set_backing_noperm(bs, new_backing_bs, set_backings_tran,
diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245
index fc5297e268..c7d671366a 100755
--- a/tests/qemu-iotests/245
+++ b/tests/qemu-iotests/245
@@ -878,7 +878,7 @@ class TestBlockdevReopen(iotests.QMPTestCase):
# We can't remove hd1 while the stream job is ongoing
opts['backing'] = None
- self.reopen(opts, {}, "Cannot change 'backing' link from 'hd0' to
'hd1'")
+ self.reopen(opts, {}, "Cannot change frozen 'backing' link from 'hd0'
to 'hd1'")
self.vm.run_job('stream0', auto_finalize = False, auto_dismiss = True)
@@ -910,7 +910,7 @@ class TestBlockdevReopen(iotests.QMPTestCase):
# We can't remove hd2 while the stream job is ongoing
opts['backing']['backing'] = None
self.reopen(opts['backing'], {'read-only': False},
- "Cannot change 'backing' link from 'hd1' to 'hd2'")
+ "Cannot change frozen 'backing' link from 'hd1' to 'hd2'")
# We can detach hd1 from hd0 because it doesn't affect the stream job
opts['backing'] = None
@@ -933,11 +933,11 @@ class TestBlockdevReopen(iotests.QMPTestCase):
# We can't remove hd2 while the commit job is ongoing
opts['backing']['backing'] = None
- self.reopen(opts, {}, "Cannot change 'backing' link from 'hd1' to
'hd2'")
+ self.reopen(opts, {}, "Cannot change frozen 'backing' link from 'hd1'
to 'hd2'")
# We can't remove hd1 while the commit job is ongoing
opts['backing'] = None
- self.reopen(opts, {}, "Cannot change 'backing' link from 'hd0' to
'hd1'")
+ self.reopen(opts, {}, "Cannot change frozen 'backing' link from 'hd0'
to 'hd1'")
event = self.vm.event_wait(name='BLOCK_JOB_READY')
self.assert_qmp(event, 'data/device', 'commit0')
--
2.31.1
- [PULL 00/24] Block layer patches, Kevin Wolf, 2021/06/30
- [PULL 02/24] block: Move read-only check during truncation earlier, Kevin Wolf, 2021/06/30
- [PULL 01/24] Prevent compiler warning on block.c, Kevin Wolf, 2021/06/30
- [PULL 03/24] block: BDRV_O_NO_IO for backing file on creation, Kevin Wolf, 2021/06/30
- [PULL 07/24] block: introduce bdrv_set_file_or_backing_noperm(), Kevin Wolf, 2021/06/30
- [PULL 06/24] block: introduce bdrv_remove_file_or_backing_child(), Kevin Wolf, 2021/06/30
- [PULL 08/24] block: bdrv_reopen_parse_backing(): don't check aio context, Kevin Wolf, 2021/06/30
- [PULL 10/24] block: bdrv_reopen_parse_backing(): simplify handling implicit filters, Kevin Wolf, 2021/06/30
- [PULL 09/24] block: bdrv_reopen_parse_backing(): don't check frozen child,
Kevin Wolf <=
- [PULL 12/24] block: BDRVReopenState: drop replace_backing_bs field, Kevin Wolf, 2021/06/30
- [PULL 04/24] block: rename bdrv_replace_child to bdrv_replace_child_tran, Kevin Wolf, 2021/06/30
- [PULL 13/24] block: Allow changing bs->file on reopen, Kevin Wolf, 2021/06/30
- [PULL 14/24] iotests: Test replacing files with x-blockdev-reopen, Kevin Wolf, 2021/06/30
- [PULL 17/24] block/ssh: add support for sha256 host key fingerprints, Kevin Wolf, 2021/06/30
- [PULL 21/24] vhost-user-blk: Add Error parameter to vhost_user_blk_start(), Kevin Wolf, 2021/06/30
- [PULL 15/24] introduce QEMU_AUTO_VFREE, Kevin Wolf, 2021/06/30
- [PULL 11/24] block: move supports_backing check to bdrv_set_file_or_backing_noperm(), Kevin Wolf, 2021/06/30
- [PULL 16/24] block/commit: use QEMU_AUTO_VFREE, Kevin Wolf, 2021/06/30
- [PULL 18/24] vhost: Add Error parameter to vhost_dev_init(), Kevin Wolf, 2021/06/30