From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 5AD091FF165 for ; Thu, 31 Jul 2025 11:08:39 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 870D2368FC; Thu, 31 Jul 2025 11:10:03 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Thu, 31 Jul 2025 11:09:49 +0200 Message-ID: <20250731090956.23443-1-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.2 MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1753952987946 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.026 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. 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-server] block job: mirror: always detach the target node upon cancelling 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: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" This is a further improvement after commit 8e671e79 ("block job: mirror: always detach the target node upon error"). It might be that a cancelled job ends up in concluded state without an error being set in the result of the 'query-block-jobs' QMP command and the target node would not be detached. To fix it, also detach the target node when cancelling the job. This is correct even when the job was cancelled after completion, as in that case, the drive is not switched over to use the target node. Reported-by: Friedrich Weber Signed-off-by: Fiona Ebner --- src/PVE/QemuServer/BlockJob.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/PVE/QemuServer/BlockJob.pm b/src/PVE/QemuServer/BlockJob.pm index f742b184..633c0b34 100644 --- a/src/PVE/QemuServer/BlockJob.pm +++ b/src/PVE/QemuServer/BlockJob.pm @@ -28,8 +28,10 @@ sub qemu_handle_concluded_blockjob { eval { mon_cmd($vmid, 'job-dismiss', id => $job_id); }; log_warn("$job_id: failed to dismiss job - $@") if $@; - # If there was an error, always detach the target. - $job->{'detach-node-name'} = $job->{'target-node-name'} if $qmp_info->{error}; + # If there was an error or if the job was cancelled, always detach the target. This is correct + # even when the job was cancelled after completion, because then the disk is not switched over + # to use the target. + $job->{'detach-node-name'} = $job->{'target-node-name'} if $qmp_info->{error} || $job->{cancel}; if (my $node_name = $job->{'detach-node-name'}) { eval { PVE::QemuServer::Blockdev::detach($vmid, $node_name); }; -- 2.47.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel