All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
	Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] block/stream: Don't stream unbacked devices
Date: Thu, 14 Nov 2013 15:07:09 +0100	[thread overview]
Message-ID: <5284D90D.6040708@redhat.com> (raw)
In-Reply-To: <20131114134122.GC26847@stefanha-thinkpad.redhat.com>

Il 14/11/2013 14:41, Stefan Hajnoczi ha scritto:
> Thanks for raising this, it's a bug that we don't verify that the image
> has a backing file.
> 
> I'd rather return an error that the user attempted to do something
> pointless.  It was a mistake on their part and it helps to bring this to
> their attention right away.

I like this patch because it avoids the risk of NULL-dereferencing
bs->backing_hd.

See here:

         /* Copy if allocated in the intermediate images.  Limit to the
          * known-unallocated area [sector_num, sector_num+n).  */
         ret = bdrv_is_allocated_above(bs->backing_hd, base,
                                       sector_num, n, &n);

where it's not at all documented that the first argument of
bdrv_is_allocated_above can be NULL.

But such a no-op streaming is valid, just like it is valid to
enable copy-on-read without a backing file.  Think of a system that
starts streaming a disk as soon as the VM starts, because *if* there's a
backing file it knows it is just a template on a remote/slow filesytem.
 It's easier for such a system to invoke the command even if there's no
backing file.

Paolo

  parent reply	other threads:[~2013-11-14 14:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-13 19:37 [Qemu-devel] [PATCH] block/stream: Don't stream unbacked devices Max Reitz
2013-11-14  3:00 ` Wenchao Xia
2013-11-14 12:15 ` Kevin Wolf
2013-11-14 13:41 ` Stefan Hajnoczi
2013-11-14 14:00   ` Eric Blake
2013-11-14 14:07   ` Paolo Bonzini [this message]
2013-11-15  8:18     ` Stefan Hajnoczi

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=5284D90D.6040708@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=stefanha@redhat.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 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.