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 1DF621FF17E for ; Thu, 13 Nov 2025 09:15:18 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 296871457F; Thu, 13 Nov 2025 09:16:12 +0100 (CET) Date: Thu, 13 Nov 2025 09:15:34 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox Backup Server development discussion References: <20251112163624.691139-1-c.ebner@proxmox.com> <20251112163624.691139-7-c.ebner@proxmox.com> In-Reply-To: <20251112163624.691139-7-c.ebner@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.17.0 (https://github.com/astroidmail/astroid) Message-Id: <1763021587.axmk7h85k9.astroid@yuna.none> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1763021712191 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.047 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pbs-devel] [PATCH proxmox-backup v2 6/6] api: datastore: wait for active operations to clear before s3 refresh 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" 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 > --- > 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 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.. > }, > )?; > > -- > 2.47.3 > > > > _______________________________________________ > pbs-devel mailing list > pbs-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel > > > _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel