From 00769414cd1044b823b65e66586e93bb79494441 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Fri, 9 Apr 2021 14:04:19 +0200 Subject: mirror: Do not enter a paused job on completion Currently, it is impossible to complete jobs on standby (i.e. paused ready jobs), but actually the only thing in mirror_complete() that does not work quite well with a paused job is the job_enter() at the end. If we make it conditional, this function works just fine even if the mirror job is paused. So technically this is a no-op, but obviously the intention is to accept block-job-complete even for jobs on standby, which we need this patch for first. Signed-off-by: Max Reitz Message-Id: <20210409120422.144040-3-mreitz@redhat.com> Signed-off-by: Kevin Wolf --- block/mirror.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'block') diff --git a/block/mirror.c b/block/mirror.c index f1f936bf1a..5a71bd8bbc 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1148,7 +1148,11 @@ static void mirror_complete(Job *job, Error **errp) } s->should_complete = true; - job_enter(job); + + /* If the job is paused, it will be re-entered when it is resumed */ + if (!job->paused) { + job_enter(job); + } } static void coroutine_fn mirror_pause(Job *job) -- cgit v1.2.3