[pve-devel] [PATCH qemu] PVE: fix aborting multiple 'CREATED' jobs in sequential transaction

Stefan Reiter s.reiter at proxmox.com
Mon Jan 4 14:49:14 CET 2021

Deadlocks could occur in the AIO_WAIT_WHILE loop in job_finish_sync,
which would wait for CREATED but not running jobs to complete, even
though job_enter is a no-op in that scenario. Mark offending jobs as
ABORTING immediately via job_update_rc if required.

Manifested itself in cancelling or failing backups with more than 2

Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>

Potential fix for #3225 and related forum threads:

 job.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/job.c b/job.c
index 97ee97a192..51984e557c 100644
--- a/job.c
+++ b/job.c
@@ -1035,6 +1035,13 @@ int job_finish_sync(Job *job, void (*finish)(Job *, Error **errp), Error **errp)
         return -EBUSY;
+    /* in a sequential transaction jobs with status CREATED can appear at time
+     * of cancelling, these have not begun work so job_enter won't do anything,
+     * let's ensure they are marked as ABORTING if required */
+    if (job->status == JOB_STATUS_CREATED && job->txn->sequential) {
+        job_update_rc(job);
+    }
                    (job_enter(job), !job_is_completed(job)));

More information about the pve-devel mailing list