public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-qemu 1/3] add optional no-cache flag to bypass host page cache on pbs-restore
Date: Tue, 18 Aug 2026 09:50:48 +0200	[thread overview]
Message-ID: <20260818075050.86065-2-c.ebner@proxmox.com> (raw)
In-Reply-To: <20260818075050.86065-1-c.ebner@proxmox.com>

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
 ...no-cache-flag-to-skip-host-page-cach.patch | 64 +++++++++++++++++++
 debian/patches/series                         |  1 +
 2 files changed, 65 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..435aab3
--- /dev/null
+++ b/debian/patches/pve/0047-pbs-restore-add-no-cache-flag-to-skip-host-page-cach.patch
@@ -0,0 +1,64 @@
+From 0000000000000000000000000000000000000000 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 like restoring to ZVOLs where page writeback can cause I/O
+delay issues in other ZFS-backed VMs on certain setups.
+
+Keeping it opt-in for full backwards compatibility, allowing to only
+enable it on targets where required.
+
+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));
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-18  7:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18  7:50 [PATCH pve-qemu qemu-server 0/3] bypass host page cache for restore on zvol Christian Ebner
2026-08-18  7:50 ` Christian Ebner [this message]
2026-08-18  7:50 ` [PATCH qemu-server 2/3] pbs-restore: set 'no-cache' on block devices backed by zfspool Christian Ebner
2026-08-18  7:50 ` [PATCH qemu-server 3/3] vma restore: skip page cache " Christian Ebner
2026-08-19 10:02 ` [PATCH pve-qemu qemu-server 0/3] bypass host page cache for restore on zvol Fiona Ebner
2026-08-19 10:43   ` Christian Ebner
2026-08-19 14:47 ` 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=20260818075050.86065-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 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