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 675EB1FF0E5 for ; Wed, 29 Jul 2026 17:34:48 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 1E50221331; Wed, 29 Jul 2026 17:34:48 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 29 Jul 2026 17:34:24 +0200 Message-Id: From: =?utf-8?q?Michael_K=C3=B6ppl?= To: "Lukas Sichert" , Subject: Re: [PATCH storage v11 2/6] lvm: saferemove: zero out volumes range by range X-Mailer: aerc 0.21.0 References: <20260723135656.102972-1-l.sichert@proxmox.com> <20260723135656.102972-3-l.sichert@proxmox.com> In-Reply-To: <20260723135656.102972-3-l.sichert@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1785339257102 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.305 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: CXP4QOYX4GDZRQG5DX7RNWKGD6RQ74DK X-Message-ID-Hash: CXP4QOYX4GDZRQG5DX7RNWKGD6RQ74DK X-MailFrom: m.koeppl@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 Thu Jul 23, 2026 at 3:56 PM CEST, Lukas Sichert wrote: [snip] > + } elsif ($zeroout_variant eq 'syswrite') { > + > + # allow retrying once if syswrite writes zero bytes > + $written =3D syswrite($fh, $zeroes, $stepsize, 0); > + if (!defined($written)) { > + die "syswrite failed: $!\n"; > + } elsif ($written =3D=3D 0) { > + warn "syswrite wrote 0 bytes, retrying"; > + } > + > + while ($written < $stepsize) { > + my $remaining =3D $stepsize - $written; > + my $retried_write =3D syswrite($fh, $zeroes, $re= maining, $written); > + if (!defined($retried_write)) { > + die "syswrite failed: $!\n"; > + } elsif ($retried_write =3D=3D 0) { > + die "syswrite failed: wrote 0 bytes"; > + } > + $written +=3D $retried_write; > + } How do we ensure here that all data is actually zeroed out on disk as well? Do we flush to disk in some way? Because if not, this might run, then immediately discard and not all data might have been zeroed out. Perhaps fsync? I think in Perl there'd be $fh->sync. Or am I missing something here and this is already guaranteed to happen? > + > + } > + $written_total +=3D $written; > + > + my $curr_time =3D clock_gettime(CLOCK_MONOTONIC); > + if (($curr_time - $lastprint) >=3D 3) { > + my $percent_finished =3D 100 * $written_total / $siz= e; [snip]