fix #4823: datastore: ignore vanished files when walking directory

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>
This commit is contained in:
Gabriel Goller 2023-09-08 14:56:10 +02:00 committed by Thomas Lamprecht
parent bc0735fee7
commit 9d1ba51de7

View 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:?}");
}