[pbs-devel] [PATCH proxmox-backup v2] fix #4823: datastore: ignore vanished files when walking directory

Gabriel Goller g.goller at proxmox.com
Fri Sep 8 14:56:10 CEST 2023


When walking through a datastore on a GC run, it can
happen that the snapshot is deleted, and then walked over.
For example:
- read dir entry for group
- walk entries (snapshots)
- snapshot X is removed/pruned
- walking reaches snapshot X, but ENOENT
Previously we bailed here, now we just ignore it.
Backups that are just created (and a atomic rename from
tmpdir happens, which might triggers a ENOENT error) are
not a problem here, the GC handles them separately.

Signed-off-by: Gabriel Goller <g.goller at proxmox.com>
---

update v2:
 - rebased, added log message

 pbs-datastore/src/datastore.rs | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index d0c2b90a..8a417bfa 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -880,6 +880,9 @@ impl DataStore {
                     return Ok(());
                 }
                 bail!("cannot continue garbage-collection safely, permission denied on: {path:?}");
+            } else if inner.kind() == io::ErrorKind::NotFound {
+                log::info!("ignoring vanished file: {path:?}");
+                return Ok(());
             } else {
                 bail!("unexpected error on datastore traversal: {inner} - {path:?}");
             }
-- 
2.39.2






More information about the pbs-devel mailing list