From b8159f39be879b1133ce89bcb2c892e0d6711fdb Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Sun, 22 Dec 2013 16:12:39 +0100 Subject: [PATCH 1/8] block/stream: Don't stream unbacked devices RH-Author: Max Reitz Message-id: <1387728759-7141-2-git-send-email-mreitz@redhat.com> Patchwork-id: 56422 O-Subject: [RHEL-7.0 qemu-kvm PATCH] block/stream: Don't stream unbacked devices Bugzilla: 965636 RH-Acked-by: Stefan Hajnoczi RH-Acked-by: Fam Zheng RH-Acked-by: Kevin Wolf BZ: 965636 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 (cherry picked from commit f4a193e717e6b5179a2e57423bfe110b724662d8) Signed-off-by: Max Reitz --- block/stream.c | 5 +++++ 1 file changed, 5 insertions(+) Signed-off-by: Miroslav Rezanina --- block/stream.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/block/stream.c b/block/stream.c index 276487c..cbae815 100644 --- a/block/stream.c +++ b/block/stream.c @@ -84,6 +84,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); -- 1.7.1