From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id E4B1860487 for ; Mon, 10 Jan 2022 12:50:49 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id DC5FB1EB for ; Mon, 10 Jan 2022 12:50:49 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id DF9DF1E1 for ; Mon, 10 Jan 2022 12:50:48 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id BB18A46C34 for ; Mon, 10 Jan 2022 12:50:48 +0100 (CET) From: Fabian Ebner To: pve-devel@lists.proxmox.com Date: Mon, 10 Jan 2022 12:50:44 +0100 Message-Id: <20220110115044.81215-1-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.140 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment 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 v2 storage] zfs: use -r parameter when listing snapshots 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: , X-List-Received-Date: Mon, 10 Jan 2022 11:50:49 -0000 Some versions of ZFS do not automatically display the child snapshots when '-t snapshot' is used, but require '-r' to be present additionally[1]. And in general, it's cleaner to specify the flag explicitly. Because of that, commit ac5c1af led to a regression[0] in the context of ZFS over iSCSI with zfs_get_sorted_snapshot_list. Fix it, by adding a -r flag again. The volume_snapshot_info function is currently only used in the context of replication and that requires a local ZFS pool, but it would be affected by the same issue if it is ever used in the context of ZFS over iSCSI, so also add -r there. [0]: https://forum.proxmox.com/threads/102683/ [1]: https://forum.proxmox.com/threads/102683/post-442577 Fixes: 8c20d8a ("plugin: add volume_snapshot_info function") Fixes: ac5c1af ("zfspool: add zfs_get_sorted_snapshot_list helper") Signed-off-by: Fabian Ebner --- Changes from v1: * Add -r in volume_snapshot_info too. PVE/Storage/ZFSPoolPlugin.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm index 5f6befd..e952a5c 100644 --- a/PVE/Storage/ZFSPoolPlugin.pm +++ b/PVE/Storage/ZFSPoolPlugin.pm @@ -398,9 +398,11 @@ sub zfs_list_zvol { sub zfs_get_sorted_snapshot_list { my ($class, $scfg, $volname, $sort_params) = @_; + my @params = ('-H', '-r', '-t', 'snapshot', '-o', 'name', $sort_params->@*); + my $vname = ($class->parse_volname($volname))[1]; + push @params, "$scfg->{pool}\/$vname"; - my @params = ('-H', '-t', 'snapshot', '-o', 'name', $sort_params->@*, "$scfg->{pool}\/$vname"); my $text = $class->zfs_request($scfg, undef, 'list', @params); my @snapshots = split(/\n/, $text); @@ -513,9 +515,11 @@ sub volume_rollback_is_possible { sub volume_snapshot_info { my ($class, $scfg, $storeid, $volname) = @_; + my @params = ('-Hp', '-r', '-t', 'snapshot', '-o', 'name,guid,creation'); + my $vname = ($class->parse_volname($volname))[1]; + push @params, "$scfg->{pool}\/$vname"; - my @params = ('-Hp', '-t', 'snapshot', '-o', 'name,guid,creation', "$scfg->{pool}\/$vname"); my $text = $class->zfs_request($scfg, undef, 'list', @params); my @lines = split(/\n/, $text); -- 2.30.2