]> git.proxmox.com Git - pve-qemu.git/commitdiff
fix #3225: properly cancel jobs in 'created' state
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 7 Jan 2021 09:26:37 +0000 (10:26 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 7 Jan 2021 09:26:37 +0000 (10:26 +0100)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
debian/patches/pve/0057-PVE-fix-aborting-multiple-CREATED-jobs-in-sequential.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/pve/0057-PVE-fix-aborting-multiple-CREATED-jobs-in-sequential.patch b/debian/patches/pve/0057-PVE-fix-aborting-multiple-CREATED-jobs-in-sequential.patch
new file mode 100644 (file)
index 0000000..0b5e601
--- /dev/null
@@ -0,0 +1,39 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Stefan Reiter <s.reiter@proxmox.com>
+Date: Mon, 4 Jan 2021 14:49:14 +0100
+Subject: [PATCH] PVE: fix aborting multiple 'CREATED' jobs in sequential
+ transaction
+
+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
+drives.
+
+Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
+Tested-by: Mira Limbeck <m.limbeck@proxmox.com>
+Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
+---
+ 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);
++    }
++
+     AIO_WAIT_WHILE(job->aio_context,
+                    (job_enter(job), !job_is_completed(job)));
index 0b4ba6063e72dd7d2e52ffa6a5db825b8f96b981..44462c2ba7ddb42b6e0f78ed7705c7f498491c67 100644 (file)
@@ -57,3 +57,4 @@ pve/0053-PVE-fix-and-clean-up-error-handling-for-create_backu.patch
 pve/0054-migration-block-dirty-bitmap-fix-larger-granularity-.patch
 pve/0055-PVE-Migrate-dirty-bitmap-state-via-savevm.patch
 pve/0056-migration-block-dirty-bitmap-migrate-other-bitmaps-e.patch
+pve/0057-PVE-fix-aborting-multiple-CREATED-jobs-in-sequential.patch