From: Kevin Wolf <kwolf@redhat.com>
To: Alex Bligh <alex@alex.org.uk>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCHv4] qemu-img rebase: use empty string to rebase without backing file
Date: Fri, 19 Oct 2012 18:46:24 +0200 [thread overview]
Message-ID: <508183E0.3000106@redhat.com> (raw)
In-Reply-To: <A1225266C0B0F081115DDD1B@nimrod.local>
Am 18.10.2012 23:20, schrieb Alex Bligh:
> Kevin,
>
> --On 17 October 2012 16:45:39 +0200 Kevin Wolf <kwolf@redhat.com> wrote:
>
>> um_sectors) {
>>> @@ -1675,7 +1679,12 @@ static int img_rebase(int argc, char **argv)
>>> * backing file are overwritten in the COW file now, so the visible content
>>> * doesn't change when we switch the backing file.
>>> */
>>> - ret = bdrv_change_backing_file(bs, out_baseimg, out_basefmt);
>>> + if (bs_new_backing) {
>>
>> I think this needs to be out_baseimg, otherwise -u is broken. I've
>> updated the patch, please check if you agree with the fix.
>
> I'm not sure I do agree.
>
> When -u is not specified, then unsafe=0. If the backing file is the empty
> string then bs_new_backing is 0 here, and the if condition evaluates to
> false, in the current patch.
>
> If you make that "if (outbase_img)" then it will still evaluate to true,
> because whilst outbase_img is non-zero, outbase_img[0] is zero.
>
> So I think you either need to do:
>
> if (bs_new_backing || unsafe)
>
> which replicates the existing behaviour, or
>
> if (out_baseimg && out_baseimg[0])
Good point, I changed it.
> As it happens, we despite what Eric Blake said, we couldn't get an unsafe
> rebase to no backing file to work with the existing code (with our without
> our patch). The second option may fix this bug. Reading line 1497, is this
> because the semantic is not 'an empty string', but 'omit -b entirely'?
> This behaviour is undocumented in the manpage which specifies -b as a
> compulsory option. If so, that's a bit unfortunate as we now have different
> semantics with and without -u. Note if no -b parameter is supplied, there
> is also a possible null pointer exception at line 1693 (null passed to
> error_report).
Right. I think not passing -b at all or passing an empty string should
have the same meaning, namely removing the backing file reference. I
won't try to modify this patch to do this, though, we can do it on top.
Kevin
next prev parent reply other threads:[~2012-10-19 16:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-16 12:46 [Qemu-devel] [PATCHv4] qemu-img rebase: use empty string to rebase without backing file Alex Bligh
2012-10-16 12:54 ` Kevin Wolf
2012-10-17 14:45 ` Kevin Wolf
2012-10-18 21:20 ` Alex Bligh
2012-10-19 16:46 ` Kevin Wolf [this message]
2012-10-19 17:08 ` Eric Blake
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=508183E0.3000106@redhat.com \
--to=kwolf@redhat.com \
--cc=alex@alex.org.uk \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.