mirror: Do not enter a paused job on completion
authorMax Reitz <mreitz@redhat.com>
Fri, 9 Apr 2021 12:04:19 +0000 (14:04 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 9 Apr 2021 16:00:29 +0000 (18:00 +0200)
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 <mreitz@redhat.com>
Message-Id: <20210409120422.144040-3-mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/mirror.c

index f1f936bf1a5880ac877e2087ae6b92221f596578..5a71bd8bbcb2c428643aee01e6046e0017326edf 100644 (file)
@@ -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)