From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id B4DB81FF0E9 for ; Thu, 16 Jul 2026 12:47:14 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 872D62144B; Thu, 16 Jul 2026 12:47:14 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 16 Jul 2026 12:46:41 +0200 Message-Id: Subject: Re: [PATCH storage v9 3/5] fix #7339: lvm: add discard action for removed volumes From: "Lukas Sichert" To: "Fiona Ebner" , References: <20260713160008.121125-1-l.sichert@proxmox.com> <20260713160008.121125-4-l.sichert@proxmox.com> <57cf0d8b-4fa7-4e00-b106-e8c997f102dc@proxmox.com> In-Reply-To: <57cf0d8b-4fa7-4e00-b106-e8c997f102dc@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1784198782040 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.150 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_LOW -0.7 Sender listed at https://www.dnswl.org/, low 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: JKQOP5QBXJUISDXG3WXBPUGZQOQ7PHFS X-Message-ID-Hash: JKQOP5QBXJUISDXG3WXBPUGZQOQ7PHFS X-MailFrom: l.sichert@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: On 2026-07-15 12:26, Fiona Ebner wrote: > Am 13.07.26 um 6:00 PM schrieb Lukas Sichert: >> +sub assert_discard_supported { >> + my ($vgname, $on_remove) =3D @_; >> + >> + return if !defined($on_remove); >> + >> + my $on_remove_opts =3D PVE::JSONSchema::parse_property_string('on-v= olume-remove', $on_remove); >> + if ($on_remove_opts->{discard}) { >> + >> + my $vgs =3D lvm_vgs(1); >> + my $vg =3D $vgs->{$vgname}; >> + die "no such volume group '$vgname'\n" if !$vg; >> + >> + my $pvs =3D $vg->{pvs}; >> + die "volume group '$vgname' has no physical volumes\n" >> + if !defined($pvs) || scalar($pvs->@*) =3D=3D 0; >> + >> + # check if all the block devices configured to the volume group= support discard >> + for my $pv ($vg->{pvs}->@*) { >> + >> + my $dev_path =3D abs_path($pv->{name}) // $pv->{name}; >> + >> + if ($dev_path =3D~ m!^(/dev/[A-Za-z0-9_+./=3D-]+)$!) { > > The information comes from LVM and is only used as the argument for > lsblk, so should we untaint with .* ? Or is there a specific reason for > this exact regex? Yes, the regex is unnecessary. But IMO .+ is better than .*, because we sho= uld not match against '/dev/'. > >> + $dev_path =3D $1; # untaint