* [PATCH pve-qemu 1/3] add optional no-cache flag to bypass host page cache on pbs-restore
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
2026-08-18 7:50 ` [PATCH qemu-server 2/3] pbs-restore: set 'no-cache' on block devices backed by zfspool Christian Ebner
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Christian Ebner @ 2026-08-18 7:50 UTC (permalink / raw)
To: pve-devel
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
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH qemu-server 2/3] pbs-restore: set 'no-cache' on block devices backed by zfspool
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 ` [PATCH pve-qemu 1/3] add optional no-cache flag to bypass host page cache on pbs-restore Christian Ebner
@ 2026-08-18 7:50 ` Christian Ebner
2026-08-18 7:50 ` [PATCH qemu-server 3/3] vma restore: skip page cache " Christian Ebner
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Christian Ebner @ 2026-08-18 7:50 UTC (permalink / raw)
To: pve-devel
Skip the host page cache for restores on zvols, as page writeback can
cause I/O delay on other ZFS-backed VMs on certain setups, as reported
in enterprise support and reproduced internally. The restored data is
not to be read back from cache during restore anyways.
Keep for other storage types to reduce regression potential.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
src/PVE/QemuServer.pm | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 2f43faa7..70d7d880 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -7090,6 +7090,11 @@ sub restore_proxmox_backup_archive {
if (PVE::Storage::volume_has_feature($storecfg, 'sparseinit', $volid)) {
push @$pbs_restore_cmd, '--skip-zero';
}
+ my ($target_storeid) = PVE::Storage::parse_volume_id($volid, 1);
+ my $target_scfg = PVE::Storage::storage_config($storecfg, $target_storeid);
+ if ($target_scfg->{type} eq 'zfspool') {
+ push @$pbs_restore_cmd, '--no-cache';
+ }
my $dbg_cmdstring = PVE::Tools::cmd2string($pbs_restore_cmd);
print "restore proxmox backup image: $dbg_cmdstring\n";
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH pve-qemu qemu-server 0/3] bypass host page cache for restore on zvol
2026-08-18 7:50 [PATCH pve-qemu qemu-server 0/3] bypass host page cache for restore on zvol Christian Ebner
` (2 preceding siblings ...)
2026-08-18 7:50 ` [PATCH qemu-server 3/3] vma restore: skip page cache " Christian Ebner
@ 2026-08-19 10:02 ` Fiona Ebner
2026-08-19 10:43 ` Christian Ebner
2026-08-19 14:47 ` Christian Ebner
4 siblings, 1 reply; 7+ messages in thread
From: Fiona Ebner @ 2026-08-19 10:02 UTC (permalink / raw)
To: Christian Ebner, pve-devel
Am 18.08.26 um 9:51 AM schrieb Christian Ebner:
> This patch series skips writing to the host page cache for restores
> to zvols, with the intention to avoid potential I/O delay issues for
> other ZFS-backed VMs during page writeback on certain setups, as
> reported in enterprise support and reproduced internally.
>
> This patch series adds an optional no-cache parameter for pbs-restore
> command invocation, setting the BDRV_O_NOCACHE flag for the block
> device being restored to and sets `cache=none` for vma restores.
>
> Since this seems to affect only zvol's, conditionally set the flag only
> during restores to storages with type `zfspool`.
>
> pve-qemu:
>
> Christian Ebner (1):
> add optional no-cache flag to bypass host page cache on pbs-restore
>
> ...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
>
> qemu-server:
>
> Christian Ebner (2):
> pbs-restore: set 'no-cache' on block devices backed by zfspool
> vma restore: skip page cache on block devices backed by zfspool
Didn't have time to look into it in detail, just noticed that there is
no version guarding. I.e. downgrading QEMU will lead to broken restore
since the old binary does not understand the new flag. We should avoid
this. If we don't want to wait until 11.1 for this, you will need to
check the revision of the binary, which requires extending the
kvm_user_version() helper to catch the package name as well ;)
The commit messages could mention that the issue is that the cache fills
up with no actual writes happening until then.
How does the change affect restore performance/load on other storages? I
kinda feel like it might make sense to do this more broadly, but of
course that requires actual data to support it. If the results are
positive, please add a reminder comment to extend this to other storages
in the future.
The general approach looks okay to me :)
^ permalink raw reply [flat|nested] 7+ messages in thread