public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 3/4] bin: proxy: initialize concurrency semaphores for datastores
Date: Thu,  4 Sep 2025 16:37:34 +0200	[thread overview]
Message-ID: <20250904143735.125857-6-h.laimer@proxmox.com> (raw)
In-Reply-To: <20250904143735.125857-1-h.laimer@proxmox.com>

... which have a `concurrency_limit` configured.

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
 src/bin/proxmox-backup-proxy.rs | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs
index cfd93f92..1678be66 100644
--- a/src/bin/proxmox-backup-proxy.rs
+++ b/src/bin/proxmox-backup-proxy.rs
@@ -251,6 +251,17 @@ async fn run() -> Result<(), Error> {
     let acceptor = make_tls_acceptor()?;
     let acceptor = Arc::new(Mutex::new(acceptor));
 
+    // create concurrent tasks semaphore
+    let (config, _digest) = pbs_config::datastore::config()?;
+    let all_stores: Vec<DataStoreConfig> = config.convert_to_typed_array("datastore")?;
+    for store in all_stores {
+        let sem_name = format!("/{}_concurrent", store.name);
+        let _ = proxmox_sys::semaphore::PosixSemaphore::unlink(&sem_name);
+        if let Some(c) = store.concurrency_limit {
+            let _ = proxmox_sys::semaphore::PosixSemaphore::create(&sem_name, 0o600, c);
+        }
+    }
+
     // to renew the acceptor we just add a command-socket handler
     command_sock.register_command("reload-certificate".to_string(), {
         let acceptor = Arc::clone(&acceptor);
-- 
2.47.2



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


  parent reply	other threads:[~2025-09-04 14:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 14:37 [pbs-devel] [RFC proxmox{, -backup} 0/6] add support for configuring max Hannes Laimer
2025-09-04 14:37 ` [pbs-devel] [PATCH proxmox 1/2] sys: add wrapper for POSIX semaphores Hannes Laimer
2025-09-04 14:37 ` [pbs-devel] [PATCH proxmox 2/2] pbs-api-types: add concurrency_limit to DataStoreConfig Hannes Laimer
2025-09-04 14:37 ` [pbs-devel] [PATCH proxmox-backup 1/4] api: config: update/delete concurrency_limit on datastore Hannes Laimer
2025-09-04 14:37 ` [pbs-devel] [PATCH proxmox-backup 2/4] Cargo.toml: add 'semaphore' feature to proxmox-sys dep Hannes Laimer
2025-09-04 14:37 ` Hannes Laimer [this message]
2025-09-04 14:37 ` [pbs-devel] [PATCH proxmox-backup 4/4] api: backup: wait for semaphore if one exists Hannes Laimer

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=20250904143735.125857-6-h.laimer@proxmox.com \
    --to=h.laimer@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