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 33CE01FF0AD for ; Thu, 20 Aug 2026 15:11:28 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id E78D4215F2; Thu, 20 Aug 2026 15:11:12 +0200 (CEST) From: Christian Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH v4 pve-qemu 1/3] pbs-restore: add optional no-cache flag to bypass host page cache Date: Thu, 20 Aug 2026 15:10:47 +0200 Message-ID: <20260820131049.374072-2-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260820131049.374072-1-c.ebner@proxmox.com> References: <20260820131049.374072-1-c.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1787231442007 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.737 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) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: BFGHKLFEAEYO3ETBCQP5OGACO5KWBUF3 X-Message-ID-Hash: BFGHKLFEAEYO3ETBCQP5OGACO5KWBUF3 X-MailFrom: c.ebner@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 X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Christian Ebner Reviewed-by: Fiona Ebner Tested-by: Jonas Theisen Tested-by: Lukas Sichert --- changes since version 3: - no changes ...no-cache-flag-to-skip-host-page-cach.patch | 72 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 73 insertions(+) create mode 100644 debian/patches/pve/0047-pbs-restore-add-no-cache-flag-to-skip-host-page-cach.patch diff --git a/debian/patches/pve/0047-pbs-restore-add-no-cache-flag-to-skip-host-page-cach.patch b/debian/patches/pve/0047-pbs-restore-add-no-cache-flag-to-skip-host-page-cach.patch new file mode 100644 index 0000000..624685e --- /dev/null +++ b/debian/patches/pve/0047-pbs-restore-add-no-cache-flag-to-skip-host-page-cach.patch @@ -0,0 +1,72 @@ +From d7ca855d826bb20cd896fe95e1cc2154ce32980d Mon Sep 17 00:00:00 2001 +From: Christian Ebner +Date: Mon, 17 Aug 2026 10:21:58 +0200 +Subject: [PATCH] pbs-restore: add no-cache flag to skip host page cache on + restore + +Optional flag which allows to set BDRV_O_NOCACHE on the block +backend, forcing to skipping the host page cache while restoring. + +Allows to explicitly skip the page cache for cases where it can cause +issues. The paage cache is filled during restores and can cause I/O +delay issues once page writeback starts, not only limited to VM's on +the same pool but possibly also affecting other ZFS-backed VMs on +certain setups, as reported in the enterprise repository and in the +community forum [0]. + +Keeping it opt-in for full backwards compatibility, allowing to only +enable it on targets where required. + +[0] https://forum.proxmox.com/threads/185023/ + +Signed-off-by: Christian Ebner +--- + pbs-restore.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/pbs-restore.c b/pbs-restore.c +index f165f418af..55a3cb235d 100644 +--- a/pbs-restore.c ++++ b/pbs-restore.c +@@ -81,6 +81,7 @@ int main(int argc, char **argv) + const char *keyfile = NULL; + int verbose = false; + bool skip_zero = false; ++ bool no_cache = false; + + error_init(argv[0]); + +@@ -93,6 +94,7 @@ int main(int argc, char **argv) + {"repository", required_argument, 0, 'r'}, + {"ns", required_argument, 0, 'n'}, + {"keyfile", required_argument, 0, 'k'}, ++ {"no-cache", no_argument, 0, 'N'}, + {0, 0, 0, 0} + }; + int c = getopt_long(argc, argv, "hvf:r:k:", long_options, NULL); +@@ -124,6 +126,9 @@ int main(int argc, char **argv) + case 'S': + skip_zero = true; + break; ++ case 'N': ++ no_cache = true; ++ break; + case 'h': + help(); + return 0; +@@ -198,6 +203,12 @@ int main(int argc, char **argv) + } + Error *local_err = NULL; + int flags = BDRV_O_RDWR; ++ if (no_cache) { ++ flags |= BDRV_O_NOCACHE; ++ if (verbose) { ++ fprintf(stderr, "skip host page cache for restore of '%s'\n", target); ++ } ++ } + BlockBackend *blk = blk_new_open(target, NULL, options, flags, &local_err); + if (!blk) { + fprintf(stderr, "%s\n", error_get_pretty(local_err)); +-- +2.47.3 + diff --git a/debian/patches/series b/debian/patches/series index 4f9ed75..6ef37f4 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -76,3 +76,4 @@ pve/0043-PVE-backup-get-device-info-allow-caller-to-specify-f.patch pve/0044-PVE-backup-implement-backup-access-setup-and-teardow.patch pve/0045-PVE-backup-prepare-for-the-switch-to-using-blockdev-.patch pve/0046-savevm-async-reuse-migration-blocker-check-for-snaps.patch +pve/0047-pbs-restore-add-no-cache-flag-to-skip-host-page-cach.patch -- 2.47.3