all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Joaquin Varela <joaquinvarela@neatech.ar>
To: pve-devel@lists.proxmox.com
Subject: [PATCH storage v5 13/13] zfsnvme: wait up to 30 seconds for the shared storage lock
Date: Thu, 26 Nov 2026 12:09:54 -0300	[thread overview]
Message-ID: <20261126150956.310593-14-joaquinvarela@neatech.ar> (raw)
In-Reply-To: <20261126150956.310593-1-joaquinvarela@neatech.ar>

The core takes the shared storage lock with the default timeout of 10
seconds around vdisk_alloc and the other volume calls. A zfsnvme
allocation holds it for several SSH round trips, so a second guest that
gets a disk at the same time can fail with "got lock request timeout".

Wait up to 30 seconds when the caller passes no timeout. An explicit
timeout is passed on unchanged.

Signed-off-by: Joaquin Varela <joaquinvarela@neatech.ar>
---
 src/PVE/Storage/ZFSNVMePlugin.pm |  6 ++++++
 src/test/zfsnvme_test.pm         | 35 +++++++++++++++++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Storage/ZFSNVMePlugin.pm b/src/PVE/Storage/ZFSNVMePlugin.pm
index 4d2eaf7e..1fdbba29 100644
--- a/src/PVE/Storage/ZFSNVMePlugin.pm
+++ b/src/PVE/Storage/ZFSNVMePlugin.pm
@@ -2159,6 +2159,12 @@ sub clone_image($class, $scfg, $storeid, $volname, $vmid, $snap = undef) {
     return "$basename/$name";
 }
 
+sub cluster_lock_storage($class, $storeid, $shared, $timeout, $func, @param) {
+    # lifecycle operations take several SSH round trips under this lock, so allow a bounded queue
+    $timeout = $nvmet_lock_wait if $shared && !defined($timeout);
+    return $class->SUPER::cluster_lock_storage($storeid, $shared, $timeout, $func, @param);
+}
+
 sub alloc_image($class, $storeid, $scfg, $vmid, $fmt, $name, $size) {
     die "unsupported format '$fmt'" if $fmt ne 'raw';
     die "illegal name '$name' - should be 'vm-$vmid-*'\n"
diff --git a/src/test/zfsnvme_test.pm b/src/test/zfsnvme_test.pm
index 4f27f38b..572a42d9 100644
--- a/src/test/zfsnvme_test.pm
+++ b/src/test/zfsnvme_test.pm
@@ -1227,6 +1227,39 @@ my @ownership = (
     is_deeply(\@runs, [], 'before running anything');
 }
 
+subtest 'cluster lock timeout defaults and passthrough' => sub {
+    my @base_calls;
+    $parent_mock->redefine(
+        cluster_lock_storage => sub($class, $storeid, $shared, $timeout, $func, @param) {
+            push @base_calls, [$class, $storeid, $shared, $timeout, @param];
+            return $func->(@param);
+        },
+    );
+    for my $case (
+        ['shared default', 1, undef, 30],
+        ['shared explicit', 1, 12, 12],
+        ['shared zero (the parent applies its own default)', 1, 0, 0],
+        ['local default', 0, undef, undef],
+    ) {
+        my ($label, $shared, $timeout, $expected) = $case->@*;
+        my $result = $PLUGIN->cluster_lock_storage(
+            'nvmetest',
+            $shared,
+            $timeout,
+            sub(@args) { return \@args },
+            'left',
+            'right',
+        );
+        is_deeply(
+            $base_calls[-1],
+            [$PLUGIN, 'nvmetest', $shared, $expected, 'left', 'right'],
+            "$label: the parent gets its arguments",
+        );
+        is_deeply($result, ['left', 'right'], "$label: the callback runs with its parameters");
+    }
+    $parent_mock->unmock('cluster_lock_storage');
+};
+
 subtest 'vdisk_alloc dispatches under the shared storage lock' => sub {
     my $cluster_mock = Test::MockModule->new('PVE::Cluster');
     my (@locks, @allocations);
@@ -1250,7 +1283,7 @@ subtest 'vdisk_alloc dispatches under the shared storage lock' => sub {
         'nvmetest:vm-105-disk-0',
         'core allocation returns the allocated volume ID',
     );
-    is_deeply(\@locks, [['nvmetest', undef]], 'cfs_lock_storage gets the timeout of the core');
+    is_deeply(\@locks, [['nvmetest', 30]], 'cfs_lock_storage waits the bounded default');
     is_deeply(
         \@allocations,
         [['nvmetest', 105, 'raw', 'vm-105-disk-0', 131_072]],
-- 
2.54.0.windows.1




  parent reply	other threads:[~2026-11-26 15:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 15:09 [PATCH storage v5 00/13] add ZFS over NVMe/TCP storage plugin Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 01/13] zfsnvme: add target state parsing and planning Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 02/13] zfsnvme: add the target transactions Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 03/13] zfsnvme: add storage configuration and volume methods Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 04/13] zfsnvme: connect the nodes and register the plugin Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 05/13] api: san luns: count zfsnvme storages as owners of their subsystem Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 06/13] api: config: check the cluster version before the first zfsnvme storage Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 07/13] test: zfsnvme: add configuration and volume tests Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 08/13] test: zfsnvme: add node side tests Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 09/13] test: zfsnvme: add an in-memory nvmet target Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 10/13] test: zfsnvme: test the target parsers and planners Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 11/13] test: zfsnvme: test the target flows Joaquin Varela
2026-11-26 15:09 ` [PATCH storage v5 12/13] test: zfsnvme: add a fault sweep, renderer and taint tests Joaquin Varela
2026-11-26 15:09 ` Joaquin Varela [this message]
2026-11-26 15:10 ` [PATCH docs v5] storage: document ZFS over NVMe/TCP Joaquin Varela
2026-11-26 15:11 ` [PATCH manager v5] ui: storage: add ZFS over NVMe/TCP editor Joaquin Varela

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=20261126150956.310593-14-joaquinvarela@neatech.ar \
    --to=joaquinvarela@neatech.ar \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal