public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] backup: check verify state of previous backup before allowing reuse
@ 2020-09-01 10:33 Stefan Reiter
  2020-09-01 13:47 ` Dominik Csapak
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Reiter @ 2020-09-01 10:33 UTC (permalink / raw)
  To: pbs-devel

Do not allow clients to reuse chunks from the previous backup if it has
a failed validation result. This would result in a new "successful"
backup that potentially references broken chunks.

If the previous backup has not been verified, assume it is fine and
continue on.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
 src/api2/backup.rs | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/api2/backup.rs b/src/api2/backup.rs
index ad608d85..c0b1d985 100644
--- a/src/api2/backup.rs
+++ b/src/api2/backup.rs
@@ -652,6 +652,19 @@ fn download_previous(
             None => bail!("no previous backup"),
         };
 
+        let (manifest, _) = env.datastore.load_manifest(&last_backup.backup_dir)?;
+        let verify = manifest.unprotected["verify_state"].clone();
+        match serde_json::from_value::<SnapshotVerifyState>(verify) {
+            Ok(verify) => {
+                if verify.state != "ok" {
+                    bail!("previous backup has failed verification");
+                }
+            },
+            Err(_) => {
+                // no verify state found, ignore and treat as valid
+            }
+        };
+
         let mut path = env.datastore.snapshot_path(&last_backup.backup_dir);
         path.push(&archive_name);
 
-- 
2.20.1





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-01 13:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-01 10:33 [pbs-devel] [PATCH proxmox-backup] backup: check verify state of previous backup before allowing reuse Stefan Reiter
2020-09-01 13:47 ` Dominik Csapak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal