The direct return will skip releasing of all the resouces at immediate_exit, don't miss that.
Signed-off-by: Fam Zheng <f...@redhat.com> --- block/mirror.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/mirror.c b/block/mirror.c index 2618c37..56dfee2 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -326,7 +326,8 @@ static void coroutine_fn mirror_run(void *opaque) 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 immediate_exit; } length = (bdrv_getlength(bs) + s->granularity - 1) / s->granularity; -- 1.9.2