From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, mreitz@redhat.com, kwolf@redhat.com,
berto@igalia.com, vsementsov@virtuozzo.com
Subject: [PATCH v6 4/9] block: bdrv_reopen_parse_backing(): don't check frozen child
Date: Thu, 10 Jun 2021 15:05:32 +0300 [thread overview]
Message-ID: <20210610120537.196183-5-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20210610120537.196183-1-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>
---
block.c | 14 +-------------
tests/qemu-iotests/245 | 8 ++++----
2 files changed, 5 insertions(+), 17 deletions(-)
diff --git a/block.c b/block.c
index 68ac99f2bd..d86e26299e 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.29.2
next prev parent reply other threads:[~2021-06-10 12:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-10 12:05 [PATCH v6 0/9] Allow changing bs->file on reopen Vladimir Sementsov-Ogievskiy
2021-06-10 12:05 ` [PATCH v6 1/9] block: introduce bdrv_remove_file_or_backing_child() Vladimir Sementsov-Ogievskiy
2021-06-10 12:05 ` [PATCH v6 2/9] block: introduce bdrv_set_file_or_backing_noperm() Vladimir Sementsov-Ogievskiy
2021-06-10 12:05 ` [PATCH v6 3/9] block: bdrv_reopen_parse_backing(): don't check aio context Vladimir Sementsov-Ogievskiy
2021-06-10 12:05 ` Vladimir Sementsov-Ogievskiy [this message]
2021-06-10 12:05 ` [PATCH v6 5/9] block: bdrv_reopen_parse_backing(): simplify handling implicit filters Vladimir Sementsov-Ogievskiy
2021-06-10 12:05 ` [PATCH v6 6/9] block: move supports_backing check to bdrv_set_file_or_backing_noperm() Vladimir Sementsov-Ogievskiy
2021-06-10 12:05 ` [PATCH v6 7/9] block: BDRVReopenState: drop replace_backing_bs field Vladimir Sementsov-Ogievskiy
2021-06-10 12:05 ` [PATCH v6 8/9] block: Allow changing bs->file on reopen Vladimir Sementsov-Ogievskiy
2021-06-10 12:05 ` [PATCH v6 9/9] iotests: Test replacing files with x-blockdev-reopen Vladimir Sementsov-Ogievskiy
2021-06-28 15:39 ` [PATCH v6 0/9] Allow changing bs->file on reopen Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210610120537.196183-5-vsementsov@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=berto@igalia.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).