[pbs-devel] [PATCH proxmox-backup 09/11] datastore: remove individual snapshots before group
Stefan Reiter
s.reiter at proxmox.com
Wed Oct 14 14:16:37 CEST 2020
Removing a snapshot has some more safety checks which we don't want to
ignore when removing an entire group (i.e. locking the manifest and
notifying GC).
Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---
src/backup/datastore.rs | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/backup/datastore.rs b/src/backup/datastore.rs
index f8c228fc..30e69e6f 100644
--- a/src/backup/datastore.rs
+++ b/src/backup/datastore.rs
@@ -215,10 +215,17 @@ impl DataStore {
let _guard = tools::fs::lock_dir_noblock(&full_path, "backup group", "possible running backup")?;
log::info!("removing backup group {:?}", full_path);
+
+ // remove all individual backup dirs first to ensure nothing is using them
+ for snap in backup_group.list_backups(&self.base_path())? {
+ self.remove_backup_dir(&snap.backup_dir, false)?;
+ }
+
+ // no snapshots left, we can now safely remove the empty folder
std::fs::remove_dir_all(&full_path)
.map_err(|err| {
format_err!(
- "removing backup group {:?} failed - {}",
+ "removing backup group directory {:?} failed - {}",
full_path,
err,
)
--
2.20.1
More information about the pbs-devel
mailing list