[pbs-devel] [PATCH proxmox-backup 6/8] rework GC traversal error handling
Fabian Grünbichler
f.gruenbichler at proxmox.com
Wed Jan 20 17:23:53 CET 2021
the error message don't make sense with an empty default
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
src/backup/datastore.rs | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/backup/datastore.rs b/src/backup/datastore.rs
index 34865380..fae7ff25 100644
--- a/src/backup/datastore.rs
+++ b/src/backup/datastore.rs
@@ -395,16 +395,18 @@ impl DataStore {
}
let handle_entry_err = |err: walkdir::Error| {
if let Some(inner) = err.io_error() {
- let path = err.path().unwrap_or(Path::new(""));
- match inner.kind() {
- io::ErrorKind::PermissionDenied => {
+ if let Some(path) = err.path() {
+ if inner.kind() == io::ErrorKind::PermissionDenied {
// only allow to skip ext4 fsck directory, avoid GC if, for example,
// a user got file permissions wrong on datastore rsync to new server
if err.depth() > 1 || !path.ends_with("lost+found") {
- bail!("cannot continue garbage-collection safely, permission denied on: {}", path.display())
+ bail!("cannot continue garbage-collection safely, permission denied on: {:?}", path)
}
- },
- _ => bail!("unexpected error on datastore traversal: {} - {}", inner, path.display()),
+ } else {
+ bail!("unexpected error on datastore traversal: {} - {:?}", inner, path)
+ }
+ } else {
+ bail!("unexpected error on datastore traversal: {}", inner)
}
}
Ok(())
--
2.20.1
More information about the pbs-devel
mailing list