From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 953FC1FF0AA for ; Fri, 21 Aug 2026 13:18:48 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 04DD7215AD; Fri, 21 Aug 2026 13:18:47 +0200 (CEST) From: Jakob Klocker To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox-backup v2 1/3] server: pull: run blocking file operations on the blocking pool Date: Fri, 21 Aug 2026 13:18:24 +0200 Message-ID: <20260821111826.299588-2-j.klocker@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260821111826.299588-1-j.klocker@proxmox.com> References: <20260821111826.299588-1-j.klocker@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 1 AWL -0.542 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 1.274 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Message-ID-Hash: VGX2I4B3CBTBXC5IUW7EAO5G73OU3THH X-Message-ID-Hash: VGX2I4B3CBTBXC5IUW7EAO5G73OU3THH X-MailFrom: jklocker@iris.proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Jakob Klocker X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The atomic renames and the unreferenced-file cleanup are blocking operations that ran directly on the runtime's worker threads, stalling other tasks scheduled there for their duration. Use the tokio counterpart for the renames and move the cleanup onto the blocking thread pool. Signed-off-by: Jakob Klocker --- src/server/pull.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/server/pull.rs b/src/server/pull.rs index 4eb5bcf11..fd401ac85 100644 --- a/src/server/pull.rs +++ b/src/server/pull.rs @@ -600,7 +600,7 @@ async fn pull_single_archive<'a>( } else { tmp_path }; - if let Err(err) = std::fs::rename(&source_path, &path) { + if let Err(err) = tokio::fs::rename(&source_path, &path).await { bail!("{archive_prefix}: Atomic rename file {path:?} failed - {err}"); } @@ -890,7 +890,7 @@ async fn pull_snapshot<'a>( nix::unistd::fsync(tmp_manifest_file.as_raw_fd())?; } - if let Err(err) = std::fs::rename(&tmp_manifest_name, &manifest_name) { + if let Err(err) = tokio::fs::rename(&tmp_manifest_name, &manifest_name).await { bail!("{prefix}: Atomic rename file {manifest_name:?} failed - {err}"); } if let DatastoreBackend::S3(s3_client) = backend { @@ -910,8 +910,9 @@ async fn pull_snapshot<'a>( fetch_log(crypt_config).await?; - snapshot - .cleanup_unreferenced_files(&manifest) + let snapshot = snapshot.clone(); + tokio::task::spawn_blocking(move || snapshot.cleanup_unreferenced_files(&manifest)) + .await? .map_err(|err| format_err!("{prefix}: failed to cleanup unreferenced files - {err}"))?; Ok(Some(sync_stats)) -- 2.47.3