[pbs-devel] [PATCH proxmox-backup v3 3/8] GC: refactor atime gathering for local chunk markers with s3 backend

Christian Ebner c.ebner at proxmox.com
Wed Oct 15 18:40:03 CEST 2025


Instead of setting the access time to the unix epoch and calculate the
atime from that, directly set the value to 0 if the marker file is not
present.

This is in preparation for also checking the to be introduced upload
markers to avoid GC races with upload/insert on s3 datastores.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
 pbs-datastore/src/datastore.rs | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index b0386421f..45e079f1a 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -1649,14 +1649,16 @@ impl DataStore {
                     // Check local markers (created or atime updated during phase1) and
                     // keep or delete chunk based on that.
                     let atime = match std::fs::metadata(&chunk_path) {
-                        Ok(stat) => stat.accessed()?,
+                        Ok(stat) => stat
+                            .accessed()?
+                            .duration_since(SystemTime::UNIX_EPOCH)?
+                            .as_secs() as i64,
                         Err(err) if err.kind() == std::io::ErrorKind::NotFound => {
                             // File not found, delete by setting atime to unix epoch
-                            SystemTime::UNIX_EPOCH
+                            0
                         }
                         Err(err) => return Err(err.into()),
                     };
-                    let atime = atime.duration_since(SystemTime::UNIX_EPOCH)?.as_secs() as i64;
 
                     let bad = chunk_path
                         .as_path()
-- 
2.47.3





More information about the pbs-devel mailing list