From: Christian Ebner <c.ebner@proxmox.com>
To: "Proxmox Backup Server development discussion"
<pbs-devel@lists.proxmox.com>,
"Fabian Grünbichler" <f.gruenbichler@proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup v2 6/6] api: datastore: wait for active operations to clear before s3 refresh
Date: Thu, 13 Nov 2025 10:03:35 +0100 [thread overview]
Message-ID: <d9b3f058-fd89-4cdc-9064-2148ee6c1eb7@proxmox.com> (raw)
In-Reply-To: <1763021587.axmk7h85k9.astroid@yuna.none>
On 11/13/25 9:15 AM, Fabian Grünbichler wrote:
> On November 12, 2025 5:36 pm, Christian Ebner wrote:
>> Currently, the s3 refresh does not take into consideration already
>> ongoing active operations, only blocking new ones.
>>
>> This will however lead to inconsistencies if there are ongoing read
>> or write operations. Therefore, actively wait for ongoing operatioins
>> to complete before running the actual refresh and keep the datastore
>> config locked so the maintenance mode cannot be altered.
>>
>> If an abort was requested while waiting, clear the maintenance mode
>> as well.
>>
>> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
>> ---
>> changes since version 1:
>> - use refactored helpers from identical unmount logic
>>
>> src/api2/admin/datastore.rs | 28 +++++++++++++++++++++++-----
>> 1 file changed, 23 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs
>> index 91189d7ae..93e085be3 100644
>> --- a/src/api2/admin/datastore.rs
>> +++ b/src/api2/admin/datastore.rs
>> @@ -2716,11 +2716,29 @@ pub fn s3_refresh(store: String, rpcenv: &mut dyn RpcEnvironment) -> Result<Valu
>> Some(store.clone()),
>> auth_id.to_string(),
>> to_stdout,
>> - move |_worker| {
>> - proxmox_async::runtime::block_on(datastore.s3_refresh())?;
>> -
>> - let (_lock, config) = expect_maintenance_type(&store, MaintenanceType::S3Refresh)?;
>> - unset_maintenance(_lock, config).context("failed to clear maintenance mode")
>> + move |worker| {
>> + let mut old_status = String::new();
>> + let aborted = wait_on_active_operations(
>> + &store,
>> + Some(&worker),
>> + MaintenanceType::S3Refresh,
>> + |reads, writes| {
>> + let status = format!(
>> + "waiting for active operations to finsish: read {reads}, write {writes}",
>> + );
>> + if status != old_status {
>> + info!("{status}");
>> + old_status = status;
>> + }
>> + },
>> + )?;
>> + clear_or_run_maintenance_locked(
>> + &store,
>> + Some(&worker),
>> + MaintenanceType::S3Refresh,
>> + aborted,
>> + || proxmox_async::runtime::block_on(datastore.s3_refresh()),
>> + )
>
> there is one more call to s3_refresh when (re)creating a datastore, that
> seems to me is running completely unprotected..
Oh, yes indeed, that needs to be adapted as well now.
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next prev parent reply other threads:[~2025-11-13 9:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-12 16:36 [pbs-devel] [PATCH proxmox-backup v2 0/6] wait for active operations to finish " Christian Ebner
2025-11-12 16:36 ` [pbs-devel] [PATCH proxmox-backup v2 1/6] api: datastore: fix typo in helper function name Christian Ebner
2025-11-12 16:36 ` [pbs-devel] [PATCH proxmox-backup v2 2/6] api: admin: make expected maintenance type helper generic over type Christian Ebner
2025-11-12 16:36 ` [pbs-devel] [PATCH proxmox-backup v2 3/6] api: admin: factor out busy waiting on active operations Christian Ebner
2025-11-13 8:15 ` Fabian Grünbichler
2025-11-13 8:38 ` Christian Ebner
2025-11-12 16:36 ` [pbs-devel] [PATCH proxmox-backup v2 4/6] api: admin: factor out locking and maintenance mode clearing Christian Ebner
2025-11-13 8:18 ` Fabian Grünbichler
2025-11-13 8:43 ` Christian Ebner
2025-11-13 9:08 ` Fabian Grünbichler
2025-11-13 9:11 ` Christian Ebner
2025-11-12 16:36 ` [pbs-devel] [PATCH proxmox-backup v2 5/6] datastore: s3 refresh: set/unset maintenance mode in api handler Christian Ebner
2025-11-12 16:36 ` [pbs-devel] [PATCH proxmox-backup v2 6/6] api: datastore: wait for active operations to clear before s3 refresh Christian Ebner
2025-11-13 8:15 ` Fabian Grünbichler
2025-11-13 9:03 ` Christian Ebner [this message]
2025-11-13 8:20 ` [pbs-devel] partially-applied: [PATCH proxmox-backup v2 0/6] wait for active operations to finish " Fabian Grünbichler
2025-11-13 14:23 ` [pbs-devel] superseded: " 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=d9b3f058-fd89-4cdc-9064-2148ee6c1eb7@proxmox.com \
--to=c.ebner@proxmox.com \
--cc=f.gruenbichler@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