summaryrefslogtreecommitdiff
path: root/block/stream.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-03-29 19:54:49 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-03-29 19:54:49 +0100
commit553934db664ecee676650fac0330dceff3531736 (patch)
tree3050cec0a882c43553cc3a7735d785746327d7b7 /block/stream.c
parent5b8e6b4cc279e4434ddda94a6b2848834883ec9c (diff)
parent409d54986d47b8279c70591e65ee4f3b1771944a (diff)
downloadqemu-553934db664ecee676650fac0330dceff3531736.tar.gz
qemu-553934db664ecee676650fac0330dceff3531736.tar.bz2
qemu-553934db664ecee676650fac0330dceff3531736.zip
Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging
# gpg: Signature made Tue 29 Mar 2016 01:48:09 BST using RSA key ID C0DE3057 # gpg: Good signature from "Jeffrey Cody <jcody@redhat.com>" # gpg: aka "Jeffrey Cody <jeff@codyprime.org>" # gpg: aka "Jeffrey Cody <codyprime@gmail.com>" * remotes/cody/tags/block-pull-request: qemu-iotests: add no-op streaming test qemu-iotests: fix test_stream_partial() block: never cancel a streaming job without running stream_complete() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'block/stream.c')
-rw-r--r--block/stream.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/block/stream.c b/block/stream.c
index 9b0b0f3573..332b9a183e 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -90,21 +90,21 @@ static void coroutine_fn stream_run(void *opaque)
StreamCompleteData *data;
BlockDriverState *bs = s->common.bs;
BlockDriverState *base = s->base;
- int64_t sector_num, end;
+ int64_t sector_num = 0;
+ int64_t end = -1;
int error = 0;
int ret = 0;
int n = 0;
void *buf;
if (!bs->backing) {
- block_job_completed(&s->common, 0);
- return;
+ goto out;
}
s->common.len = bdrv_getlength(bs);
if (s->common.len < 0) {
- block_job_completed(&s->common, s->common.len);
- return;
+ ret = s->common.len;
+ goto out;
}
end = s->common.len >> BDRV_SECTOR_BITS;
@@ -191,6 +191,7 @@ wait:
qemu_vfree(buf);
+out:
/* Modify backing chain and close BDSes in main loop */
data = g_malloc(sizeof(*data));
data->ret = ret;