[pbs-devel] [RFC v2 proxmox-backup 05/42] datastore: ignore missing owner file when removing group directory
Christian Ebner
c.ebner at proxmox.com
Thu May 29 16:31:30 CEST 2025
Since commit 23be00a4 ("fix #3336: datastore: remove group if the
last snapshot is removed"), a backup group directory is cleaned up
when the new locking mechanism is in use once:
- the group is requested to be destroyed and all the snapshots have
been deleted
- the last snapshot of a group has been destroyed
Since then, the owner file is also cleaned up separately.
However, the owner file might be already missing due to removal of
the group directory executed when removing the last backup snapshot
of the group, making the subsequent call in the backup group destroy
method fail.
Fix this by ignoring a missing owner file and continue with trying to
emove the group directory itself.
Fixes: 23be00a4 ("fix #3336: datastore: remove group if the last snapshot is removed")
Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
pbs-datastore/src/backup_info.rs | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/pbs-datastore/src/backup_info.rs b/pbs-datastore/src/backup_info.rs
index d4732fdd9..1422fe865 100644
--- a/pbs-datastore/src/backup_info.rs
+++ b/pbs-datastore/src/backup_info.rs
@@ -246,9 +246,11 @@ impl BackupGroup {
fn remove_group_dir(&self) -> Result<(), Error> {
let owner_path = self.store.owner_path(&self.ns, &self.group);
- std::fs::remove_file(&owner_path).map_err(|err| {
- format_err!("removing the owner file '{owner_path:?}' failed - {err}")
- })?;
+ if let Err(err) = std::fs::remove_file(&owner_path) {
+ if err.kind() != std::io::ErrorKind::NotFound {
+ bail!("removing the owner file '{owner_path:?}' failed - {err}");
+ }
+ }
let path = self.full_group_path();
--
2.39.5
More information about the pbs-devel
mailing list