From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 7CE4465D03 for ; Mon, 4 Jan 2021 14:49:27 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6DA931DD61 for ; Mon, 4 Jan 2021 14:49:27 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id C480A1DD55 for ; Mon, 4 Jan 2021 14:49:25 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 88D1D4506E for ; Mon, 4 Jan 2021 14:49:25 +0100 (CET) From: Stefan Reiter To: pve-devel@lists.proxmox.com Date: Mon, 4 Jan 2021 14:49:14 +0100 Message-Id: <20210104134914.20294-1-s.reiter@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.041 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH qemu] PVE: fix aborting multiple 'CREATED' jobs in sequential transaction X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 13:49:27 -0000 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 --- 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