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 571731FF0B3 for ; Thu, 26 Nov 2026 16:11:54 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 32A0E21863; Thu, 26 Nov 2026 16:11:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=neatech-ar.20260707.gappssmtp.com; s=20260707; t=1795705822; x=1796310622; darn=lists.proxmox.com; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=T2Uj6vAeeOSNQ3e5V3rXhJWvldEeOtnEaWeqohvR6Rc=; b=mgrlu0NAXh6zD9h/HFxY3RNf351Vr4/QYcr6EFF5ALZ8UdLvhMA6f396Yv5K4G6fJV WZVo0xXfGyi91DuVdtxj1J5s1SDfervcEMsRREbiq3/jkmn6/+jxPR+9TN2zWzNnHuDR lVS6jag117aef3oiPvJv94vC+/YstYL/p19LZMmP4U6nqi8n9tMeFPgnhMAoNHHPPvKI ERmUY324nQPpY0nkRDKjbWWOVrGxZDH5ETpMfjvUsyA1G89PcmUnUm2O70YWm1p74P+c /jv80X0Qr37cbP2D15CdBChNRh/KUn3gbY26rFZmuGcf7YCS484r90yk5y1+8yBCHMNJ fxUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795705822; x=1796310622; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=T2Uj6vAeeOSNQ3e5V3rXhJWvldEeOtnEaWeqohvR6Rc=; b=chgqPEXp0mK6TG9ieWb8slevQI0J7x78uo74fwoEhcpE5ltiUTUu7dKGM3Md6I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/gfEQ/b5HUZzduyiaGYxe9kHoaUPoO4YgM+tiX+6dbrvBTgUAbDAqN ld/2X4zdduJbEDRouTPWnuesE8qJxdw== X-Received: by 2002:a05:6102:6309:10b0:7c3:83a9:eddd with SMTP id ada2fe7eead31-7d72b37ca78mr13925362137.1.1795705821531; Thu, 26 Nov 2026 07:10:21 -0800 (PST) From: Joaquin Varela 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 Message-ID: <20261126150956.310593-14-joaquinvarela@neatech.ar> X-Mailer: git-send-email 2.54.0.windows.1 In-Reply-To: <20261126150956.310593-1-joaquinvarela@neatech.ar> References: <20261126150956.310593-1-joaquinvarela@neatech.ar> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.241 Adjusted score from AWL reputation of From: address DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DMARC_PASS -0.1 DMARC pass policy RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no 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: NE4XODEOQAXNY43Y6GLX5PXFOCTISSBZ X-Message-ID-Hash: NE4XODEOQAXNY43Y6GLX5PXFOCTISSBZ X-MailFrom: joaquinvarela@neatech.ar 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: 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 --- 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