From: Max Reitz Date: Wed, 13 Nov 2013 19:37:58 +0000 (+0100) Subject: block/stream: Don't stream unbacked devices X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=f4a193e717e6b5179a2e57423bfe110b724662d8;p=qemu.git block/stream: Don't stream unbacked devices If a block device is unbacked, a streaming blockjob should immediately finish instead of beginning to try to stream, then noticing the backing file does not contain even the first sector (since it does not exist) and then finishing normally. Signed-off-by: Max Reitz Reviewed-by: Wenchao Xia Signed-off-by: Kevin Wolf --- diff --git a/block/stream.c b/block/stream.c index 694fd42e41..46bec7d379 100644 --- a/block/stream.c +++ b/block/stream.c @@ -88,6 +88,11 @@ static void coroutine_fn stream_run(void *opaque) int n = 0; void *buf; + if (!bs->backing_hd) { + block_job_completed(&s->common, 0); + return; + } + s->common.len = bdrv_getlength(bs); if (s->common.len < 0) { block_job_completed(&s->common, s->common.len);