cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
0a122b
From b8159f39be879b1133ce89bcb2c892e0d6711fdb Mon Sep 17 00:00:00 2001
0a122b
From: Max Reitz <mreitz@redhat.com>
0a122b
Date: Sun, 22 Dec 2013 16:12:39 +0100
0a122b
Subject: [PATCH 1/8] block/stream: Don't stream unbacked devices
0a122b
0a122b
RH-Author: Max Reitz <mreitz@redhat.com>
0a122b
Message-id: <1387728759-7141-2-git-send-email-mreitz@redhat.com>
0a122b
Patchwork-id: 56422
0a122b
O-Subject: [RHEL-7.0 qemu-kvm PATCH] block/stream: Don't stream unbacked devices
0a122b
Bugzilla: 965636
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
RH-Acked-by: Fam Zheng <famz@redhat.com>
0a122b
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
0a122b
0a122b
BZ: 965636
0a122b
0a122b
If a block device is unbacked, a streaming blockjob should immediately
0a122b
finish instead of beginning to try to stream, then noticing the backing
0a122b
file does not contain even the first sector (since it does not exist)
0a122b
and then finishing normally.
0a122b
0a122b
Signed-off-by: Max Reitz <mreitz@redhat.com>
0a122b
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
(cherry picked from commit f4a193e717e6b5179a2e57423bfe110b724662d8)
0a122b
0a122b
Signed-off-by: Max Reitz <mreitz@redhat.com>
0a122b
---
0a122b
 block/stream.c | 5 +++++
0a122b
 1 file changed, 5 insertions(+)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 block/stream.c |    5 +++++
0a122b
 1 files changed, 5 insertions(+), 0 deletions(-)
0a122b
0a122b
diff --git a/block/stream.c b/block/stream.c
0a122b
index 276487c..cbae815 100644
0a122b
--- a/block/stream.c
0a122b
+++ b/block/stream.c
0a122b
@@ -84,6 +84,11 @@ static void coroutine_fn stream_run(void *opaque)
0a122b
     int n = 0;
0a122b
     void *buf;
0a122b
 
0a122b
+    if (!bs->backing_hd) {
0a122b
+        block_job_completed(&s->common, 0);
0a122b
+        return;
0a122b
+    }
0a122b
+
0a122b
     s->common.len = bdrv_getlength(bs);
0a122b
     if (s->common.len < 0) {
0a122b
         block_job_completed(&s->common, s->common.len);
0a122b
-- 
0a122b
1.7.1
0a122b