[pbs-devel] [PATCH v2 proxmox-backup 5/5] backup: touch all chunks, even if they exist

Stefan Reiter s.reiter at proxmox.com
Mon Sep 7 17:30:36 CEST 2020


We need to update the atime of chunk files if they already exist,
otherwise a concurrently running GC could sweep them away.

This is protected with ChunkStore.mutex, so the fstat/unlink does not
race with touching.

Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---

New in v2.

 src/backup/chunk_store.rs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/backup/chunk_store.rs b/src/backup/chunk_store.rs
index abe1d67f..1d9de70a 100644
--- a/src/backup/chunk_store.rs
+++ b/src/backup/chunk_store.rs
@@ -414,6 +414,7 @@ impl ChunkStore {
 
         if let Ok(metadata) = std::fs::metadata(&chunk_path) {
             if metadata.is_file() {
+                self.touch_chunk(digest)?;
                 return Ok((true, metadata.len()));
             } else {
                 bail!("Got unexpected file type on store '{}' for chunk {}", self.name, digest_str);
-- 
2.20.1






More information about the pbs-devel mailing list