From: Max Reitz <mreitz@redhat.com>
To: Alberto Garcia <berto@igalia.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Subject: Re: [PATCH for-5.1] qcow2: Don't open images with a backing file and the data-file-raw bit
Date: Fri, 19 Jun 2020 09:57:27 +0200 [thread overview]
Message-ID: <80d5af9c-0b8b-472a-fba2-cace33be6053@redhat.com> (raw)
In-Reply-To: <w51r1uctwc2.fsf@maestria.local.igalia.com>
[-- Attachment #1.1: Type: text/plain, Size: 2523 bytes --]
On 18.06.20 14:03, Alberto Garcia wrote:
> On Wed 03 Jun 2020 03:53:03 PM CEST, Max Reitz wrote:
>> Sorry for the long delay. :/
>
> And sorry for my long delay as well.
>
>> The patch itself looks good, but I’m not sure whether it is extensive
>> enough. Let me just jump straight to the problem:
>>
>> $ ./qemu-img create -f qcow2 \
>> -o data_file=foo.qcow2.raw,data_file_raw=on \
>> foo.qcow2 64M
>> (Create some file empty foo.qcow2 with external data file that’s raw)
>>
>> $ ./qemu-img create -f qcow2 backing.qcow2 64M
>> $ ./qemu-io -c 'write -P 42 0 64M' backing.qcow2
>> (Create some file filled with 42s)
>>
>> $ ./qemu-img compare foo.qcow2 foo.qcow2.raw
>> Images are identical.
>> (As expected, foo.qcow2 is identical to its raw data file)
>>
>> $ ./qemu-img compare --image-opts \
>> file.filename=foo.qcow2,backing.file.filename=backing.qcow2 \
>> file.filename=foo.qcow2.raw
>> Content mismatch at offset 0!
>> (Oops.)
>
> If two images have the same contents but then you compare them changing
> the backing file of one of them you can also get a content mismatch. How
> is this different?
It’s different in that files with data-file-raw can’t have backing files
at all. So maybe users shouldn’t be allowed to give them backing files
at runtime either.
Or at least, if we have data-file-raw, *all* data visible on such an
image should be taken from the raw data file, never from any backing file.
> Regardless of how we should ideally handle bs->backing and data-file-raw
> (and yes I agree that it would be nice that QEMU would say "you cannot
> have a backing file and an external raw file" in all cases) I think that
> if the problem is that the user can override the backing file name and
> get different contents, then that's not a problem that we should be
> worried about.
Well, not really be worried about, but I do think it’s indicative of
some problem, though I’m not sure whether the problem is error
reporting. I think it’s rather the fact that data-file-raw should imply
metadata preallocation.
With preallocation, we’d ensure that we always take all data from the
raw data file. So we’d always ignore any potential backing file.
(It makes sense to guard users against giving images with data-file-raw
a backing file, and to consider such images corrupt, as done by this
patch. But if users can force a backing file at runtime, I think
showing its contents is another bug.)
Max
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2020-06-19 7:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-15 19:02 [PATCH for-5.1] qcow2: Don't open images with a backing file and the data-file-raw bit Alberto Garcia
2020-04-15 21:09 ` Eric Blake
2020-05-19 17:46 ` Alberto Garcia
2020-06-03 13:53 ` Max Reitz
2020-06-05 11:14 ` Kevin Wolf
2020-06-05 12:11 ` Max Reitz
2020-06-05 13:00 ` Kevin Wolf
2020-06-05 14:38 ` Max Reitz
2020-06-18 12:03 ` Alberto Garcia
2020-06-19 7:57 ` Max Reitz [this message]
2020-06-19 11:06 ` Alberto Garcia
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=80d5af9c-0b8b-472a-fba2-cace33be6053@redhat.com \
--to=mreitz@redhat.com \
--cc=berto@igalia.com \
--cc=kwolf@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 NNTP newsgroup(s).