]> git.proxmox.com Git - pve-qemu.git/blame - debian/patches/pve/0057-PVE-fix-aborting-multiple-CREATED-jobs-in-sequential.patch
fix #3084: fall back to open-iscsi initiatorname
[pve-qemu.git] / debian / patches / pve / 0057-PVE-fix-aborting-multiple-CREATED-jobs-in-sequential.patch
CommitLineData
b515d45e
WB
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Stefan Reiter <s.reiter@proxmox.com>
3Date: Mon, 4 Jan 2021 14:49:14 +0100
4Subject: [PATCH] PVE: fix aborting multiple 'CREATED' jobs in sequential
5 transaction
6
7Deadlocks could occur in the AIO_WAIT_WHILE loop in job_finish_sync,
8which would wait for CREATED but not running jobs to complete, even
9though job_enter is a no-op in that scenario. Mark offending jobs as
10ABORTING immediately via job_update_rc if required.
11
12Manifested itself in cancelling or failing backups with more than 2
13drives.
14
15Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
16Tested-by: Mira Limbeck <m.limbeck@proxmox.com>
17Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
18---
19 job.c | 7 +++++++
20 1 file changed, 7 insertions(+)
21
22diff --git a/job.c b/job.c
23index 97ee97a192..51984e557c 100644
24--- a/job.c
25+++ b/job.c
26@@ -1035,6 +1035,13 @@ int job_finish_sync(Job *job, void (*finish)(Job *, Error **errp), Error **errp)
27 return -EBUSY;
28 }
29
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) {
34+ job_update_rc(job);
35+ }
36+
37 AIO_WAIT_WHILE(job->aio_context,
38 (job_enter(job), !job_is_completed(job)));
39