]> git.proxmox.com Git - proxmox-backup.git/commitdiff
fix #4823: datastore: ignore vanished files when walking directory
authorGabriel Goller <g.goller@proxmox.com>
Fri, 8 Sep 2023 12:56:10 +0000 (14:56 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 18 Sep 2023 14:42:39 +0000 (16:42 +0200)
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@proxmox.com>
pbs-datastore/src/datastore.rs

index 29b9c779f50c1d9b881b9d49c87eec66a83d12d5..41c9f4f21030d3a21354afd0e4803017c91f1521 100644 (file)
@@ -881,6 +881,9 @@ impl DataStore {
                 // .. but do not ignore EPERM in general, otherwise we might prune too many chunks.
                 // E.g., if users messed up with owner/perms on a rsync
                 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:?}");
             }