From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/2] qcow2: mark image as corrupt if failing during create
Date: Tue, 19 Feb 2019 16:19:28 +0000 [thread overview]
Message-ID: <20190219161928.GP7154@redhat.com> (raw)
In-Reply-To: <42f0ea75-99c6-6e6d-2fd5-b3b59f4a781c@redhat.com>
On Tue, Feb 19, 2019 at 10:11:58AM -0600, Eric Blake wrote:
> On 2/19/19 6:50 AM, Daniel P. Berrangé wrote:
> > During creation we write a minimal qcow2 header and then update it with
> > extra features. If the updating fails for some reason we might still be
> > left with a valid qcow2 image that will be mistakenly used for I/O. We
> > cannot delete the image, since we don't know if we created the
> > underlying storage or not. Thus we mark the header as corrupt to
> > prevents its later usage.
>
> Should we unconditionally mark the image as corrupt at the time we write
> the minimal qcow2 header, and then update the image to non-corrupt on
> the final update?
That's a nice idea, but we call blk_new_open() half way through to
qcow2_co_create method to open the minimal image. If we mark it
corrupt upfront we'll never be able to open this minimal image.
Adding a flag to allow blk_new_open to ignore the "corrupt" marker
feels unplesant to me.
>
> >
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> > block/qcow2.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/block/qcow2.c b/block/qcow2.c
> > index ecc577175f..338513e652 100644
> > --- a/block/qcow2.c
> > +++ b/block/qcow2.c
> > @@ -3104,6 +3104,9 @@ qcow2_co_create(BlockdevCreateOptions *create_options, Error **errp)
> >
> > ret = 0;
> > out:
> > + if (ret < 0) {
> > + qcow2_mark_corrupt(blk_bs(blk));
> > + }
>
> If ret < 0 because of an EIO error, this may also fail to write the
> change to the header. Hence my question as to whether this is too late.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2019-02-19 16:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-19 12:50 [Qemu-devel] [PATCH 0/2] qcow2: improve error handling when luks creation fails Daniel P. Berrangé
2019-02-19 12:50 ` [Qemu-devel] [PATCH 1/2] qcow2: fail if encryption opts are provided to non-encrypted image Daniel P. Berrangé
2019-02-19 15:56 ` Eric Blake
2019-02-22 19:17 ` Max Reitz
2019-02-25 10:36 ` Daniel P. Berrangé
2019-02-19 12:50 ` [Qemu-devel] [PATCH 2/2] qcow2: mark image as corrupt if failing during create Daniel P. Berrangé
2019-02-19 16:11 ` Eric Blake
2019-02-19 16:19 ` Daniel P. Berrangé [this message]
2019-02-22 19:21 ` Max Reitz
2019-02-25 10:40 ` Daniel P. Berrangé
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=20190219161928.GP7154@redhat.com \
--to=berrange@redhat.com \
--cc=eblake@redhat.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 NNTP newsgroup(s).