[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] block/stream: Don't stream unbacked devices
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] block/stream: Don't stream unbacked devices |
Date: |
Thu, 14 Nov 2013 15:07:09 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130923 Thunderbird/17.0.9 |
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