From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 26BA79194F for ; Thu, 2 Feb 2023 14:05:06 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 08720CEA1 for ; Thu, 2 Feb 2023 14:04:36 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Thu, 2 Feb 2023 14:04:35 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 4321E40B47 for ; Thu, 2 Feb 2023 14:04:35 +0100 (CET) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pbs-devel@lists.proxmox.com Date: Thu, 2 Feb 2023 14:04:24 +0100 Message-Id: <20230202130424.3446075-2-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230202130424.3446075-1-f.gruenbichler@proxmox.com> References: <20230202130424.3446075-1-f.gruenbichler@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.127 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [verify.rs, datastore.rs] Subject: [pbs-devel] [PATCH proxmox-backup 2/2] verify/protect: improve error on disappearing snapshots X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Feb 2023 13:05:06 -0000 or clients passing in a non-existent snapshot. Signed-off-by: Fabian Grünbichler --- pbs-datastore/src/datastore.rs | 4 ++++ src/backup/verify.rs | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs index 6f37e886..bf951305 100644 --- a/pbs-datastore/src/datastore.rs +++ b/pbs-datastore/src/datastore.rs @@ -1180,6 +1180,10 @@ impl DataStore { pub fn update_protection(&self, backup_dir: &BackupDir, protection: bool) -> Result<(), Error> { let full_path = backup_dir.full_path(); + if !full_path.exists() { + bail!("snapshot {} does not exist!", backup_dir.dir()); + } + let _guard = lock_dir_noblock(&full_path, "snapshot", "possibly running or in use")?; let protected_path = backup_dir.protected_file(); diff --git a/src/backup/verify.rs b/src/backup/verify.rs index 3984e28d..c972e532 100644 --- a/src/backup/verify.rs +++ b/src/backup/verify.rs @@ -328,6 +328,16 @@ pub fn verify_backup_dir( upid: UPID, filter: Option<&dyn Fn(&BackupManifest) -> bool>, ) -> Result { + if !backup_dir.full_path().exists() { + task_log!( + verify_worker.worker, + "SKIPPED: verify {}:{} - snapshot does not exist (anymore).", + verify_worker.datastore.name(), + backup_dir.dir(), + ); + return Ok(true); + } + let snap_lock = lock_dir_noblock_shared( &backup_dir.full_path(), "snapshot", -- 2.30.2