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