From 068e52686221ab3b41c4213b5747d885ae1fa920 Mon Sep 17 00:00:00 2001 From: Stefan Reiter Date: Mon, 7 Sep 2020 17:30:36 +0200 Subject: [PATCH] backup: touch all chunks, even if they exist 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 --- 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);