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 4EEF71FF0E1 for ; Mon, 13 Jul 2026 15:24:08 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id AA3DF21405; Mon, 13 Jul 2026 15:24:07 +0200 (CEST) From: Robert Obkircher To: pbs-devel@lists.proxmox.com Subject: [PATCH v1 proxmox-backup 1/3] datastore: fix local path for .i.bad chunk files during S3 GC Date: Mon, 13 Jul 2026 15:22:24 +0200 Message-ID: <20260713132338.170565-2-r.obkircher@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260713132338.170565-1-r.obkircher@proxmox.com> References: <20260713132338.170565-1-r.obkircher@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1783949028599 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.335 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: OPJ5ZD6JCRUW2VID7RVZHCEIXX2CVKBP X-Message-ID-Hash: OPJ5ZD6JCRUW2VID7RVZHCEIXX2CVKBP X-MailFrom: r.obkircher@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 Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Do not push an additional path segment with the extension, and rename the confusing variable. The additional segment caused a rather cryptic "TASK ERROR: Not a directory (os error 20)" error during Phase 2 if the .i.bad file existed locally. If it doesn't exist locally, the S3 object was and continues to be deleted, unless it is the very first one and the corresponding chunk expected marker exists. This behavior might not be desirable if the files are missing because the datastore was recreated with the "reuse existing datastore" option. Fixes: 27e3f5b7b ("GC: fix: don't drop bad extension for S3 object to chunk path helper") Signed-off-by: Robert Obkircher --- pbs-datastore/src/datastore.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs index e2d1ae67c..3079fe833 100644 --- a/pbs-datastore/src/datastore.rs +++ b/pbs-datastore/src/datastore.rs @@ -2678,8 +2678,8 @@ impl DataStore { // Check object is actually a chunk let path = Path::new::(object_key); // file_name() should always be Some, as objects will have a filename - let digest = path.file_name()?; - let bytes = digest.as_bytes(); + let file_name = path.file_name()?; + let bytes = file_name.as_bytes(); let bad_ext_len = ".0.bad".len(); let bad_chunk = if bytes.len() == 64 + bad_ext_len { true @@ -2693,19 +2693,15 @@ impl DataStore { } // Safe since contains valid ascii hexdigits only as checked above. - let digest_str = digest.to_string_lossy(); + let digest_str = file_name.to_string_lossy(); let hexdigit_prefix = unsafe { digest_str.get_unchecked(0..4) }; let mut chunk_path = self.base_path(); chunk_path.push(".chunks"); chunk_path.push(hexdigit_prefix); - chunk_path.push(digest); - if bad_chunk { - let extension = unsafe { digest_str.get_unchecked(64..64 + bad_ext_len) }; - chunk_path.push(extension); - } + chunk_path.push(file_name); let mut digest_bytes = [0u8; 32]; - let digest = digest.as_bytes(); + let digest = file_name.as_bytes(); // safe to unwrap as already checked above hex::decode_to_slice(&digest[..64], &mut digest_bytes).unwrap(); -- 2.47.3