public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dietmar Maurer <dietmar@proxmox.com>
To: Proxmox Backup Server development discussion
	<pbs-devel@lists.proxmox.com>,
	 Stefan Reiter <s.reiter@proxmox.com>
Subject: Re: [pbs-devel] [PATCH RESEND proxmox-backup 2/3] backup: check verify state of previous backup before allowing reuse
Date: Thu, 10 Sep 2020 07:02:22 +0200 (CEST)	[thread overview]
Message-ID: <1289824957.1093.1599714142805@webmail.proxmox.com> (raw)
In-Reply-To: <20200908132944.5876-2-s.reiter@proxmox.com>


> On 09/08/2020 3:29 PM Stefan Reiter <s.reiter@proxmox.com> wrote:
> 
>  
> 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.

This patch does not prevent that, because in create_fixed_index():

 
        let last_backup = match &env.last_backup {
            Some(info) => info,
            None => {
                bail!("cannot reuse index - no previous backup exists");
            }
        };

So we allow reuse there!

I suggest to do those checks earlier in upgrade_to_backup_protocol()

> 
> If the previous backup has not been verified, assume it is fine and
> continue on.
> 
> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
> ---
> 
> Patch 3 is much more useful with this one applied first, so here it is again
> instead of a ping for easy review/application :)
> 
>  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
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel




  reply	other threads:[~2020-09-10  5:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-08 13:29 [pbs-devel] [PATCH proxmox-backup 1/3] backup: ensure no fixed index writers are left over either Stefan Reiter
2020-09-08 13:29 ` [pbs-devel] [PATCH RESEND proxmox-backup 2/3] backup: check verify state of previous backup before allowing reuse Stefan Reiter
2020-09-10  5:02   ` Dietmar Maurer [this message]
2020-09-08 13:29 ` [pbs-devel] [PATCH v3 proxmox-backup 3/3] backup: check all referenced chunks actually exist Stefan Reiter
2020-09-10  4:29 ` [pbs-devel] applied: [PATCH proxmox-backup 1/3] backup: ensure no fixed index writers are left over either Dietmar Maurer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1289824957.1093.1599714142805@webmail.proxmox.com \
    --to=dietmar@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    --cc=s.reiter@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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