From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 3794B1FF0AF for ; Fri, 20 Nov 2026 15:10:35 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id BB2AB2178C; Fri, 20 Nov 2026 15:10:32 +0100 (CET) From: Jonas Theisen To: pve-devel@lists.proxmox.com Subject: [PATCH storage 0/2] rbd: avoid hanging VM start on EFI disk cache policy Date: Fri, 20 Nov 2026 15:10:05 +0100 Message-ID: <20261120141020.243160-1-j.theisen@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795183828308 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.083 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) 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 Message-ID-Hash: AWG4TBI6JGGDVU3OAYTJMGMWMI2X6UQ7 X-Message-ID-Hash: AWG4TBI6JGGDVU3OAYTJMGMWMI2X6UQ7 X-MailFrom: j.theisen@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Starting a VM with an EFI disk on RBD sets the rbd_cache_policy image config on every start. On the target of a live migration, the source VM still holds the exclusive lock, so librbd forwards the write to it and re-sends the request every 30 seconds until the lock owner reports completion. 'rbd config image set' then hangs without end if: - the lock owner never reports completion, or - the completion arrives just after a re-send timed out, but before the request is sent again. The requester drops it, and the lock owner answers every further re-send of the finished request with its result, 0 on success. That is the same answer as for a request still in progress, so the requester waits for a completion that is never sent again. See prepare_async_request() in librbd's ImageWatcher.cc. The VM start on the target, and thus the migration, then hangs until the rbd process is killed. Patch 1 reads the current value first and only writes it if it differs. Reading the image config does not involve the lock owner, and after the first start the value is already set, so migrations no longer depend on the lock owner in the common case. This reverses the choice made in commit 590fb762 ("plugin: qemu block device: add hints option and EFI disk hint"), which deliberately set the value unconditionally: querying it was considered to only add cost, and 'rbd config image get' fails if the key has not been set yet. The extra read is one cheap command per VM start with an EFI disk on RBD, which is a small price for not hanging the migration. The failing 'get' on an unset key is handled by treating any error as "not set" and falling back to writing the value, as before. Patch 2 covers the remaining case, where the value does need to be written while another client holds the lock: the write is aborted after 60 seconds, which allows for one retry of the remote request, and a failure only results in a warning. The cache policy only affects the performance of EFI variable writes, so it should not fail the VM start, and thus the migration. In the best case we would not need this because the rbd command never hangs, but there have been cases in Enterprise Support where this exact failure mode blocked migrations. Jonas Theisen (2): rbd: only set image config if the value differs rbd: do not let setting the EFI disk cache policy block VM start src/PVE/Storage/RBDPlugin.pm | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) -- 2.47.3