[Top][All Lists]

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

Re: [Qemu-block] [PATCH v8 03/26] block: Add BDS.backing_overridden

From: Max Reitz
Subject: Re: [Qemu-block] [PATCH v8 03/26] block: Add BDS.backing_overridden
Date: Thu, 22 Feb 2018 15:55:07 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 2018-02-22 14:39, Kevin Wolf wrote:
> Am 05.02.2018 um 16:18 hat Max Reitz geschrieben:
>> If the backing file is overridden, this most probably does change the
>> guest-visible data of a BDS. Therefore, we will need to consider this in
>> bdrv_refresh_filename().
>> Adding a new field to the BDS is not nice, but it is very simple and
>> exactly keeps track of whether the backing file has been overridden.
> ...as long as we manage to actually keep it up to date all the time.
> First of all, what I'm missing here (or in fact in the comment in the
> code) is a definition what "overridden" really means. "specified by the
> user" is kind of vague: You consider the backing file relationship for
> snapshot=on as user specified, even though the user wasn't explicit
> about this. On the other hand, creating a live snapshot results in a
> node that isn't user specified.
> Isn't the real question to ask whether the default backing file (taken
> from the image header) would result in the same tree? The answer to this
> changes after more operations, like qmp_change_backing_file().

With you so far.

> Considering that there are so many ways to change the answer, I think
> the simplest reliable option isn't a new BDS field that needs to updated
> everywhere, but looking at the current value of bs->options and
> bs->backing_file and see if they match.

I don't see how that is simple.  First, bs->options does not necessarily
reflect the "current options", those would be bs->full_open_options.
And for generating that, we need a way to determine whether the backing
file has been overridden or not, so whether we need to put the backing
options into it or whether we do not.

(I am right that bs->backing_file is what the image header says, right?
So we need to compare it against something that reflects the runtime state.)

What I could see would be comparing bs->backing_file to
bs->backing->bs->filename.  But this sounds very hacky to me.

One thing the comes to mind is that it can break whenever
bdrv_refresh_filename() is clever.  So you specify
'json:{"driver":"null-co"}' in the image header, and
bdrv_refresh_filename() optimizes that to "null-co://".  Now the
filenames differ even though it's still the original filename.  So this
wouldn't work very well either.


>> This commit adds a FIXME which will be remedied by a follow-up commit.
>> Until then, the respective piece of code will not result in any behavior
>> that is worse than what we currently have.
>> Signed-off-by: Max Reitz <address@hidden>
>> Reviewed-by: Eric Blake <address@hidden>
>> Reviewed-by: Alberto Garcia <address@hidden>
> Kevin

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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