public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Robert Obkircher <r.obkircher@proxmox.com>
To: Christian Ebner <c.ebner@proxmox.com>
Cc: pbs-devel@lists.proxmox.com
Subject: Re: [PATCH proxmox-backup v3 09/10] api: config: unlocked s3 bucket access check for datastore creation
Date: Thu, 23 Jul 2026 13:52:10 +0200	[thread overview]
Message-ID: <178480753020.88450.9707249359570598383.b4-review@b4> (raw)
In-Reply-To: <20260721103643.333028-10-c.ebner@proxmox.com>

> Instead of holding the lock for the whole datastore creation, use the
> maintenance-mode `create`, protected by the maintenance-mode lock.
> It is inserted and written to the config when setting the maintenance
> mode before even starting any datastore related operation. Cleanup
> from config if creation failed must be performed manually.
> 
> This has the advantage that a potentially long running creation does
> not block any concurrent access to the datastore config, thereby
> blocking also any unrelated datastore.
> 
> The config has to be re-parsed a second time for this, but given that
> this unblocks the config and this is no performance critical path
> that tradeoff is better than its alternative. By refactoring the
> helpers to set and unset the maintenance mode, they can be reused for
> all call sites.
> 
> Rely on re-acquisition of the lock to also succeed if other operations
> are being performed, due to the 10s timeout.
> 
> Ordering of locking cannot always be preserved, but deadlocks are
> excluded by timeouts.
> 
> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
>[..]
> @@ -253,8 +253,27 @@ pub fn create_datastore_disk(
>                      bail!("datastore '{}' already exists.", datastore.name);
>                  }
>  
> +                let maintenance_mode_lock =
> +                    pbs_datastore::maintenance_mode_lock(&datastore.name, &lock)?;
> +                crate::api2::helpers::set_maintenance_type(
> +                    lock,
> +                    &maintenance_mode_lock,
> +                    &mut datastore,
> +                    MaintenanceType::Create,
> +                )?;
> +
Isn't this too early to drop the config lock? 

For example the `datastore.ensure_not_nested(&existing_stores)` inside
do_create_datastore could now potentially miss a newly created
datastore.

-- 
Robert Obkircher <r.obkircher@proxmox.com>




  reply	other threads:[~2026-07-23 11:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21 10:36 [PATCH proxmox{,-backup} v3 00/10] keep datastore config unlocked during long running operations Christian Ebner
2026-07-21 10:36 ` [PATCH proxmox v3 01/10] pbs-api-types: add datastore create maintenance-mode type Christian Ebner
2026-07-21 10:36 ` [PATCH proxmox-backup v3 02/10] api: config: rearrange independent code block for datastore creation Christian Ebner
2026-07-21 10:36 ` [PATCH proxmox-backup v3 03/10] api/datastore: refactor datastore creation helper logic Christian Ebner
2026-07-21 10:36 ` [PATCH proxmox-backup v3 04/10] datastore: restrict chunk store scope to pbs-datastore crate Christian Ebner
2026-07-23 11:52   ` Robert Obkircher
2026-07-21 10:36 ` [PATCH proxmox-backup v3 05/10] datastore: move lock files base path constant to central location Christian Ebner
2026-07-23 11:52   ` Robert Obkircher
2026-07-21 10:36 ` [PATCH proxmox-backup v3 06/10] datastore: move file lock helper to centralized place Christian Ebner
2026-07-21 10:36 ` [PATCH proxmox-backup v3 07/10] datastore: create lockdir with correct mode for backup user access Christian Ebner
2026-07-23 11:52   ` Robert Obkircher
2026-07-21 10:36 ` [PATCH proxmox-backup v3 08/10] api/datastore: use maintenance-mode lock to protect against changes Christian Ebner
2026-07-23 11:52   ` Robert Obkircher
2026-07-21 10:36 ` [PATCH proxmox-backup v3 09/10] api: config: unlocked s3 bucket access check for datastore creation Christian Ebner
2026-07-23 11:52   ` Robert Obkircher [this message]
2026-07-23 14:31     ` Christian Ebner
2026-07-21 10:36 ` [PATCH proxmox-backup v3 10/10] datastore: protect datastore creation by maintenance-mode Christian 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=178480753020.88450.9707249359570598383.b4-review@b4 \
    --to=r.obkircher@proxmox.com \
    --cc=c.ebner@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