1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Stefan Reiter <s.reiter@proxmox.com>
3 Date: Mon, 4 Jan 2021 14:49:14 +0100
4 Subject: [PATCH] PVE: fix aborting multiple 'CREATED' jobs in sequential
7 Deadlocks could occur in the AIO_WAIT_WHILE loop in job_finish_sync,
8 which would wait for CREATED but not running jobs to complete, even
9 though job_enter is a no-op in that scenario. Mark offending jobs as
10 ABORTING immediately via job_update_rc if required.
12 Manifested itself in cancelling or failing backups with more than 2
15 Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
16 Tested-by: Mira Limbeck <m.limbeck@proxmox.com>
17 Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
20 1 file changed, 7 insertions(+)
22 diff --git a/job.c b/job.c
23 index 8f06e05fbf..05b7797e82 100644
26 @@ -1035,6 +1035,13 @@ int job_finish_sync(Job *job, void (*finish)(Job *, Error **errp), Error **errp)
30 + /* in a sequential transaction jobs with status CREATED can appear at time
31 + * of cancelling, these have not begun work so job_enter won't do anything,
32 + * let's ensure they are marked as ABORTING if required */
33 + if (job->status == JOB_STATUS_CREATED && job->txn->sequential) {
37 AIO_WAIT_WHILE(job->aio_context,
38 (job_enter(job), !job_is_completed(job)));