qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block/stream: Don't stream unbacked devices
@ 2013-11-13 19:37 Max Reitz
  2013-11-14  3:00 ` Wenchao Xia
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Max Reitz @ 2013-11-13 19:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Paolo Bonzini, Stefan Hajnoczi, Max Reitz

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>
---
 block/stream.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/block/stream.c b/block/stream.c
index 694fd42..46bec7d 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);
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-11-15  8:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-13 19:37 [Qemu-devel] [PATCH] block/stream: Don't stream unbacked devices Max Reitz
2013-11-14  3:00 ` Wenchao Xia
2013-11-14 12:15 ` Kevin Wolf
2013-11-14 13:41 ` Stefan Hajnoczi
2013-11-14 14:00   ` Eric Blake
2013-11-14 14:07   ` Paolo Bonzini
2013-11-15  8:18     ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).