]>
Commit | Line | Data |
---|---|---|
b515d45e WB |
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 | |
5 | transaction | |
6 | ||
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. | |
11 | ||
12 | Manifested itself in cancelling or failing backups with more than 2 | |
13 | drives. | |
14 | ||
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> | |
18 | --- | |
19 | job.c | 7 +++++++ | |
20 | 1 file changed, 7 insertions(+) | |
21 | ||
22 | diff --git a/job.c b/job.c | |
23 | index 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 |