* [Qemu-devel] [PATCH 0/1] Never cancel a streaming job without running stream_complete()
@ 2016-03-17 15:35 Alberto Garcia
2016-03-17 15:35 ` [Qemu-devel] [PATCH 1/1] block: never " Alberto Garcia
0 siblings, 1 reply; 2+ messages in thread
From: Alberto Garcia @ 2016-03-17 15:35 UTC (permalink / raw)
To: qemu-devel; +Cc: Alberto Garcia, qemu-block
Hi,
this is a simple fix that was ready one year ago but never made it
through because it was part of the intermediate block streaming
series.
While I'm retaking the work on that series and I plan to send a new
version sooner or later, I think there's no reason to delay this patch
even more.
Although the patch is one year old, I decided to keep all the R-b
lines because nothing has really changed in this code since then and I
don't believe the change is controversial.
Berto
Alberto Garcia (1):
block: never cancel a streaming job without running stream_complete()
block/stream.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
--
2.7.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Qemu-devel] [PATCH 1/1] block: never cancel a streaming job without running stream_complete()
2016-03-17 15:35 [Qemu-devel] [PATCH 0/1] Never cancel a streaming job without running stream_complete() Alberto Garcia
@ 2016-03-17 15:35 ` Alberto Garcia
0 siblings, 0 replies; 2+ messages in thread
From: Alberto Garcia @ 2016-03-17 15:35 UTC (permalink / raw)
To: qemu-devel; +Cc: Alberto Garcia, qemu-block
We need to call stream_complete() in order to do all the necessary
clean-ups, even if there's an early failure. At the moment it's only
useful to make sure that s->backing_file_str is not leaked, but it
will become more important if we introduce support for streaming to
any intermediate node.
Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
block/stream.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/block/stream.c b/block/stream.c
index cafaa07..eea3938 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -89,21 +89,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;
@@ -190,6 +190,7 @@ wait:
qemu_vfree(buf);
+out:
/* Modify backing chain and close BDSes in main loop */
data = g_malloc(sizeof(*data));
data->ret = ret;
--
2.7.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-17 15:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-17 15:35 [Qemu-devel] [PATCH 0/1] Never cancel a streaming job without running stream_complete() Alberto Garcia
2016-03-17 15:35 ` [Qemu-devel] [PATCH 1/1] block: never " Alberto Garcia
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).