[pbs-devel] [RFC v2 proxmox-backup 06/21] api: tape: check trash marker when trying to write snapshot

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri May 9 14:27:42 CEST 2025


On May 8, 2025 3:05 pm, Christian Ebner wrote:
> 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 923cb7834..17c8bc605 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_trashed() {
> +                info!("snapshot {snapshot_path:?} trashed, skipping");

not sure why we log this, but don't log this in other places?

> +                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
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
> 
> 




More information about the pbs-devel mailing list