public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Jonas Theisen <j.theisen@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH storage 2/2] rbd: do not let setting the EFI disk cache policy block VM start
Date: Fri, 20 Nov 2026 15:10:07 +0100	[thread overview]
Message-ID: <20261120141020.243160-3-j.theisen@proxmox.com> (raw)
In-Reply-To: <20261120141020.243160-1-j.theisen@proxmox.com>

Setting the rbd_cache_policy image config while another client holds
the exclusive lock, e.g. the source VM during a live migration, is
forwarded to the lock owner. If the owner never reports completion, or
its completion is lost in a race with a re-send of the request, the
'rbd config image set' command never returns and the VM start on the
migration target hangs indefinitely.

Abort the command after 60 seconds, which allows for one retry of the
remote request, as librbd retries those every 30 seconds.

The cache policy only affects the performance of EFI variable writes,
so only warn if setting it fails, instead of failing the VM start and
thus the migration.

Signed-off-by: Jonas Theisen <j.theisen@proxmox.com>
---
 src/PVE/Storage/RBDPlugin.pm | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/PVE/Storage/RBDPlugin.pm b/src/PVE/Storage/RBDPlugin.pm
index 1b2caf8..a209f6f 100644
--- a/src/PVE/Storage/RBDPlugin.pm
+++ b/src/PVE/Storage/RBDPlugin.pm
@@ -419,7 +419,12 @@ sub rbd_volume_config_set {
     return if !$@ && defined($current) && $current eq $value;
 
     my $cmd = $rbd_cmd->($scfg, $storeid, 'config', 'image', 'set', $volname, $key, $value);
-    run_rbd_command($cmd, errmsg => "rbd config image set $volname $key $value error");
+    # librbd retries a remote request every 30 seconds, so allow for one retry
+    run_rbd_command(
+        $cmd,
+        errmsg => "rbd config image set $volname $key $value error",
+        timeout => 60,
+    );
 
     return;
 }
@@ -633,7 +638,9 @@ sub qemu_blockdev_options {
 
     # SPI flash does lots of read-modify-write OPs, without writeback this gets really slow #3329
     if ($options->{hints}->{'efi-disk'}) {
-        rbd_volume_config_set($scfg, $storeid, $name, 'rbd_cache_policy', 'writeback');
+        # only affects performance, so do not fail the VM start, e.g. on the migration target
+        eval { rbd_volume_config_set($scfg, $storeid, $name, 'rbd_cache_policy', 'writeback') };
+        warn "could not set rbd_cache_policy for EFI disk '$name' - $@" if $@;
     }
 
     return $blockdev;
-- 
2.47.3





      parent reply	other threads:[~2026-11-20 14:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 14:10 [PATCH storage 0/2] rbd: avoid hanging VM start on EFI disk cache policy Jonas Theisen
2026-11-20 14:10 ` [PATCH storage 1/2] rbd: only set image config if the value differs Jonas Theisen
2026-11-20 14:10 ` Jonas Theisen [this message]

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=20261120141020.243160-3-j.theisen@proxmox.com \
    --to=j.theisen@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