all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH v3 pve-qemu 1/1] pbs-restore: add optional no-cache flag to bypass host page cache
Date: Thu, 20 Aug 2026 11:05:23 +0200	[thread overview]
Message-ID: <20260820090528.117853-2-c.ebner@proxmox.com> (raw)
In-Reply-To: <20260820090528.117853-1-c.ebner@proxmox.com>

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Jonas Theisen <j.theisen@proxmox.com>
---
changes since version 2:
- Extended commit message for patch to include further details and the
  link to the forum thread
- adapted commit title to use pbs-restore as prefix tag

 ...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 <c.ebner@proxmox.com>
+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 <c.ebner@proxmox.com>
+---
+ 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





  reply	other threads:[~2026-08-20  9:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-20  9:05 [PATCH v3 pve-qemu qemu-server 0/6] bypass host page cache for restore on zvol Christian Ebner
2026-08-20  9:05 ` Christian Ebner [this message]
2026-08-20  9:05 ` [PATCH v3 qemu-server 2/6] helpers: never cache `unknown` on failed kvm binary version check Christian Ebner
2026-08-20  9:05 ` [PATCH v3 qemu-server 3/6] helpers: optionally get package version for kvm_user_version() Christian Ebner
2026-08-20  9:05 ` [PATCH v3 qemu-server 4/6] helpers: add helper for min kvm package version comparison Christian Ebner
2026-08-20  9:05 ` [PATCH v3 qemu-server 5/6] pbs-restore: set 'no-cache' on block devices backed by zfspool Christian Ebner
2026-08-20  9:05 ` [PATCH v3 qemu-server 6/6] vma restore: skip page cache " Christian Ebner
2026-08-20  9:56 ` [PATCH v3 pve-qemu qemu-server 0/6] bypass host page cache for restore on zvol Lukas Sichert
2026-08-20 12:07   ` Thomas Lamprecht
2026-08-20 12:36     ` Christian Ebner
2026-08-20 11:36 ` Lukas Sichert
2026-08-20 13:12 ` 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=20260820090528.117853-2-c.ebner@proxmox.com \
    --to=c.ebner@proxmox.com \
    --cc=pve-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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal