all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH v2 proxmox-backup] fix: avoid loss of concurrent config changes during datastore deletion
@ 2025-11-03 14:53 Robert Obkircher
  2025-11-06 17:54 ` [pbs-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Obkircher @ 2025-11-03 14:53 UTC (permalink / raw)
  To: 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 <r.obkircher@proxmox.com>
Reviewed-by: Christian Ebner <c.ebner@proxmox.com>
Tested-by: Christian Ebner <c.ebner@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


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

* [pbs-devel] applied: [PATCH v2 proxmox-backup] fix: avoid loss of concurrent config changes during datastore deletion
  2025-11-03 14:53 [pbs-devel] [PATCH v2 proxmox-backup] fix: avoid loss of concurrent config changes during datastore deletion Robert Obkircher
@ 2025-11-06 17:54 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-11-06 17:54 UTC (permalink / raw)
  To: pbs-devel, Robert Obkircher

On Mon, 03 Nov 2025 15:53:31 +0100, Robert Obkircher wrote:
> 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:
> 
> [...]

Applied, thanks!

[1/1] fix: avoid loss of concurrent config changes during datastore deletion
      commit: b9a00e99d091b663a52c3ebadee0fa6460f03ef3


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


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

end of thread, other threads:[~2025-11-06 17:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-03 14:53 [pbs-devel] [PATCH v2 proxmox-backup] fix: avoid loss of concurrent config changes during datastore deletion Robert Obkircher
2025-11-06 17:54 ` [pbs-devel] applied: " Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal