From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox 2/4] rest-server: use shared instead of exclusive lock for old task cleanup
Date: Wed, 18 Nov 2026 19:02:26 +0100 [thread overview]
Message-ID: <20261118180228.341628-3-c.ebner@proxmox.com> (raw)
In-Reply-To: <20261118180228.341628-1-c.ebner@proxmox.com>
Cleanup of old task logs happens by identifying the oldest task entry
in the task archive. To protect against races by concurrent task
archive file updates, this is protected by a file lock.
Currently an exclusive lock is acquired, the oldest task cleanup
however only reads, never modifies the files so a shared lock is
sufficient. Since active worker updates and task log archive rotation
still acquire an exclusive lock, they cannot interfere.
Parts of the iteration via the task list info iterator might now
happen concurrently, but these cannot interfere since both read the
same task from the archive, which does not include old task logs to
be cleaned up and active worker updates during iteration still
require the exclusive lock.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
proxmox-rest-server/src/worker_task.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/proxmox-rest-server/src/worker_task.rs b/proxmox-rest-server/src/worker_task.rs
index dfd0def6..d43c42ba 100644
--- a/proxmox-rest-server/src/worker_task.rs
+++ b/proxmox-rest-server/src/worker_task.rs
@@ -358,7 +358,7 @@ pub fn rotate_task_log_archive(
pub fn cleanup_old_tasks(compressed: bool) -> Result<(), Error> {
let setup = worker_task_setup()?;
- let _lock = setup.lock_task_list_files(true)?;
+ let _lock = setup.lock_task_list_files(false)?;
let logrotate = LogRotate::new(&setup.task_archive_fn, compressed, None, None)?;
--
2.47.3
next prev parent reply other threads:[~2026-11-18 18:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 18:02 [PATCH proxmox 0/4] fix #8341: reduce task list lock contention during old task log cleanup Christian Ebner
2026-11-18 18:02 ` [PATCH proxmox 1/4] sys: fs: report lock timeouts as such instead of EINTR Christian Ebner
2026-11-19 10:18 ` Robert Obkircher
2026-11-19 10:53 ` Christian Ebner
2026-11-18 18:02 ` Christian Ebner [this message]
2026-11-18 18:02 ` [PATCH proxmox 3/4] fix #8341: rest-server: do not lock task list during old log cleanup Christian Ebner
2026-11-18 18:02 ` [PATCH proxmox 4/4] rest-server: clamp old task log cleanup cutoff to earliest active task Christian Ebner
2026-11-19 10:55 ` Robert Obkircher
2026-11-19 11:06 ` 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=20261118180228.341628-3-c.ebner@proxmox.com \
--to=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 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.