From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 2B1421FF187 for ; Mon, 3 Nov 2025 15:54:22 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A495B205C0; Mon, 3 Nov 2025 15:55:00 +0100 (CET) From: Robert Obkircher To: pbs-devel@lists.proxmox.com Date: Mon, 3 Nov 2025 15:53:31 +0100 Message-ID: <20251103145422.128701-1-r.obkircher@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1762181650517 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.000 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy 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 Subject: [pbs-devel] [PATCH v2 proxmox-backup] fix: avoid loss of concurrent config changes during datastore deletion 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: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Fix a race between the initial reading of the datastore config before destroying the datastore and concurrent config changes, by re-reading the config in a locked context before removing the just destroyed datastore from it. Previously, the following steps created files in /srv/test2 but removed test2 from the configuration: proxmox-backup-manager datastore create test1 /srv/test1 proxmox-backup-manager datastore remove test1 --destroy-data & sleep 0.1 proxmox-backup-manager datastore create test2 /srv/test2 Reported-by: https://forum.proxmox.com/threads/174715/ Signed-off-by: Robert Obkircher Reviewed-by: Christian Ebner Tested-by: Christian Ebner --- pbs-datastore/src/datastore.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs index 03830616..14dad93a 100644 --- a/pbs-datastore/src/datastore.rs +++ b/pbs-datastore/src/datastore.rs @@ -2154,6 +2154,8 @@ impl DataStore { if ok { info!("Removing datastore from config..."); let _lock = pbs_config::datastore::lock_config()?; + // read again to avoid loosing concurrent modifications + let (mut config, _digest) = pbs_config::datastore::config()?; let _ = config.sections.remove(name); pbs_config::datastore::save_config(&config)?; } -- 2.47.3 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel