summaryrefslogtreecommitdiff
path: root/block/stream.c
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2013-11-13 20:37:58 +0100
committerKevin Wolf <kwolf@redhat.com>2013-11-28 11:39:31 +0100
commitf4a193e717e6b5179a2e57423bfe110b724662d8 (patch)
treeeee9919b69c91f27618531e602d0b45aa6ffbf76 /block/stream.c
parent8582972227196c289bb3b28086b3b2d01071d958 (diff)
downloadqemu-f4a193e717e6b5179a2e57423bfe110b724662d8.tar.gz
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 <mreitz@redhat.com> Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/stream.c')
-rw-r--r--block/stream.c5
1 files changed, 5 insertions, 0 deletions
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);