From: Alberto Garcia <berto@igalia.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Kashyap Chamarthy <kchamart@redhat.com>,
qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: Re: [RFC PATCH 1/2] block: Allow changing bs->file on reopen
Date: Tue, 19 Jan 2021 12:46:14 +0100 [thread overview]
Message-ID: <w51im7tw3nd.fsf@maestria.local.igalia.com> (raw)
In-Reply-To: <53852b77-1b29-0c27-0083-ac6e263b560e@virtuozzo.com>
On Mon 18 Jan 2021 11:15:17 AM CET, Vladimir Sementsov-Ogievskiy wrote:
>> +static int bdrv_reopen_parse_file(BDRVReopenState *reopen_state,
>> + GSList **tran,
>> + Error **errp)
>> +{
>> + BlockDriverState *bs = reopen_state->bs;
>> + BlockDriverState *new_file_bs;
>> + QObject *value;
>> + const char *str;
>> +
>> + value = qdict_get(reopen_state->options, "file");
>> + if (value == NULL) {
>> + return 0;
>> + }
>> +
>> + /* The 'file' option only allows strings */
>> + assert(qobject_type(value) == QTYPE_QSTRING);
>> +
>> + str = qobject_get_try_str(value);
>> + new_file_bs = bdrv_lookup_bs(NULL, str, errp);
>> + if (new_file_bs == NULL) {
>> + return -EINVAL;
>> + } else if (bdrv_recurse_has_child(new_file_bs, bs)) {
>> + error_setg(errp, "Making '%s' a file of '%s' "
>> + "would create a cycle", str, bs->node_name);
>> + return -EINVAL;
>> + }
>> +
>> + assert(bs->file && bs->file->bs);
>
> why are we sure at this point? Probably, we should just return an
> error..
Unlike 'backing', 'file' is a BlockdevRef and it is not optional, so
block devices that accept that parameter must have it set.
>> + /* At the moment only backing links are frozen */
>> + assert(!bs->file->frozen);
>
> I think it can: file-child based filters can be a part of frozen
> backing chain currently.
You're right, since 7b99a26600e bdrv_freeze_backing_chain() uses
bdrv_filter_or_cow_child().
Berto
next prev parent reply other threads:[~2021-01-19 11:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-15 13:02 [RFC PATCH 0/2] Allow changing bs->file on reopen Alberto Garcia
2021-01-15 13:02 ` [RFC PATCH 1/2] block: " Alberto Garcia
2021-01-18 10:15 ` Vladimir Sementsov-Ogievskiy
2021-01-19 11:46 ` Alberto Garcia [this message]
2021-01-15 13:02 ` [RFC PATCH 2/2] iotests: Update 245 to support replacing files with x-blockdev-reopen Alberto Garcia
2021-01-15 13:31 ` [RFC PATCH 0/2] Allow changing bs->file on reopen Kashyap Chamarthy
2021-01-18 10:22 ` Vladimir Sementsov-Ogievskiy
2021-01-20 13:51 ` Alberto Garcia
2021-01-20 13:55 ` Vladimir Sementsov-Ogievskiy
2021-01-21 10:52 ` Kevin Wolf
2021-02-05 12:47 ` Alberto Garcia
2021-02-05 15:41 ` 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=w51im7tw3nd.fsf@maestria.local.igalia.com \
--to=berto@igalia.com \
--cc=kchamart@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
/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 NNTP newsgroup(s).