public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Robert Obkircher <r.obkircher@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] Avoid lost updates to configuration during datastore deletion
Date: Thu, 30 Oct 2025 11:48:50 +0100	[thread overview]
Message-ID: <20251030105034.45964-1-r.obkircher@proxmox.com> (raw)

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/possible-bug-when-deleting-a-datastore.174715/
Signed-off-by: Robert Obkircher <r.obkircher@proxmox.com>
---
 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


             reply	other threads:[~2025-10-30 10:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-30 10:48 Robert Obkircher [this message]
2025-10-30 12:05 ` Fiona Ebner

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=20251030105034.45964-1-r.obkircher@proxmox.com \
    --to=r.obkircher@proxmox.com \
    --cc=pbs-devel@lists.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