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 D91291FF0AB for ; Wed, 07 Oct 2026 11:41:35 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 57C65213C5; Wed, 07 Oct 2026 11:41:34 +0200 (CEST) From: Arthur Bied-Charreton To: pve-devel@lists.proxmox.com Subject: [PATCH pve-storage] partially-fix #7840: storage: read import output until 'ready' Date: Wed, 7 Oct 2026 11:41:11 +0200 Message-ID: <20261007094111.731097-1-a.bied-charreton@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1791366089733 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.102 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_MED -2.3 Sender listed at https://www.dnswl.org/, medium 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: 6FI6Q7VCTMWL2S6UUPYC6D5LL3ENJZS4 X-Message-ID-Hash: 6FI6Q7VCTMWL2S6UUPYC6D5LL3ENJZS4 X-MailFrom: a.bied-charreton@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: volume_import_start() spawns `pvesm import`, merges the subprocess' stdout and stderr into one stream, and took the first line read from it as the readiness signal. Any unrelated output the child emits first was therefore mistaken for "ready", and the socket path was returned to the caller before the child has bound and listened on it. Read lines until one is exactly "ready", passing the earlier ones through, and fail explicitly if the child reached EOF first. Link: https://bugzilla.proxmox.com/show_bug.cgi?id=7840 Signed-off-by: Arthur Bied-Charreton --- src/PVE/Storage.pm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm index 64ea9da..60b5dcc 100755 --- a/src/PVE/Storage.pm +++ b/src/PVE/Storage.pm @@ -2214,14 +2214,19 @@ sub volume_import_start { my $cpid = open3($input, $info, $info, @$import) or die "failed to spawn disk-import child - $!\n"; - my $ready; + my ($ready, $output) = (0, ''); eval { - PVE::Tools::run_with_timeout(5, sub { $ready = <$info>; }); + PVE::Tools::run_with_timeout(5, sub { + while (defined(my $line = <$info>)) { + return $ready = 1 if $line eq "ready\n"; + $output .= $line; + } + }); }; + die "failed to read readiness from disk import child: $@\n$output" if $@; + die "disk import child exited before signalling readiness\n$output" if !$ready; - die "failed to read readyness from disk import child: $@\n" if $@; - - print "$ready\n"; + print "${output}ready\n"; return { fh => $info, -- 2.47.3