[pbs-devel] [PATCH v3 proxmox-backup 10/20] api: tape: check trash marker when trying to write snapshot

Christian Ebner c.ebner at proxmox.com
Tue May 13 15:52:37 CEST 2025


Since snapshots might be marked as trash, the snapshot directory
can still be present until cleaned up by garbage collection.

Therefore, check for the presence of the trash marker after acquiring
the locked snapshot reader and skip over marked ones.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
 src/api2/tape/backup.rs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/api2/tape/backup.rs b/src/api2/tape/backup.rs
index 158905990..0adac96af 100644
--- a/src/api2/tape/backup.rs
+++ b/src/api2/tape/backup.rs
@@ -574,7 +574,13 @@ fn backup_snapshot(
     info!("backup snapshot {snapshot_path:?}");
 
     let snapshot_reader = match snapshot.locked_reader() {
-        Ok(reader) => reader,
+        Ok(reader) => {
+            if snapshot.is_trash() {
+                info!("snapshot {snapshot_path:?} marked as trash, skipping");
+                return Ok(SnapshotBackupResult::Ignored);
+            }
+            reader
+        }
         Err(err) => {
             if !snapshot.full_path().exists() {
                 // we got an error and the dir does not exist,
-- 
2.39.5





More information about the pbs-devel mailing list