diff options
author | Max Reitz <mreitz@redhat.com> | 2013-11-13 20:37:58 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2013-11-28 11:39:31 +0100 |
commit | f4a193e717e6b5179a2e57423bfe110b724662d8 (patch) | |
tree | eee9919b69c91f27618531e602d0b45aa6ffbf76 /block | |
parent | 8582972227196c289bb3b28086b3b2d01071d958 (diff) |
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')
-rw-r--r-- | block/stream.c | 5 |
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); |