public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Reiter <s.reiter@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu] PVE: fix aborting multiple 'CREATED' jobs in sequential transaction
Date: Mon,  4 Jan 2021 14:49:14 +0100	[thread overview]
Message-ID: <20210104134914.20294-1-s.reiter@proxmox.com> (raw)

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>
---

Potential fix for #3225 and related forum threads:
https://forum.proxmox.com/threads/problem-mit-backup.80418/
https://forum.proxmox.com/threads/vm-hard-freezes-on-backup.81752/

 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)));
 
-- 
2.20.1





             reply	other threads:[~2021-01-04 13:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04 13:49 Stefan Reiter [this message]
2021-01-05  9:52 ` Mira Limbeck
2021-01-07 10:23 ` [pve-devel] applied: " Wolfgang Bumiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210104134914.20294-1-s.reiter@proxmox.com \
    --to=s.reiter@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal