[pbs-devel] [PATCH proxmox-backup v4 14/14] chunk store: never fail when trying to remove missing chunk file

Christian Ebner c.ebner at proxmox.com
Mon Nov 10 12:56:27 CET 2025


Although this is an unexpected case, never fail if the chunk store
marker is not there during removal from cache in phase 2 of garbage
collection for datastores with s3 backend (that codepath needs no
further adaption). The chunk file might be missing for other reasons,
e.g. after manual intervention in offline maintenance mode.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
 pbs-datastore/src/chunk_store.rs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/pbs-datastore/src/chunk_store.rs b/pbs-datastore/src/chunk_store.rs
index 273b17d5f..efc950fcc 100644
--- a/pbs-datastore/src/chunk_store.rs
+++ b/pbs-datastore/src/chunk_store.rs
@@ -712,7 +712,12 @@ impl ChunkStore {
     pub(crate) fn remove_chunk(&self, digest: &[u8; 32]) -> Result<(), Error> {
         let (chunk_path, _digest_str) = self.chunk_path(digest);
         let _lock = self.mutex.lock();
-        std::fs::remove_file(chunk_path).map_err(Error::from)
+        if let Err(err) = std::fs::remove_file(chunk_path) {
+            if err.kind() != std::io::ErrorKind::NotFound {
+                return Err(err.into());
+            }
+        }
+        Ok(())
     }
 
     pub fn relative_path(&self, path: &Path) -> PathBuf {
-- 
2.47.3





More information about the pbs-devel mailing list