nbdkit/0044-server-Fix-.zero-fallback-path.patch
Richard W.M. Jones 4450b8fbd9 server: Fix .zero fallback path
resolves: RHEL-101635
2025-07-05 08:47:55 +01:00

40 lines
1.2 KiB
Diff

From e947a2a55cb018711b7f4ede5b5cec291ed5cf24 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 2 Jul 2025 16:18:19 +0100
Subject: [PATCH] server: Fix .zero fallback path
When no efficient zero method is supported, we fall back to writing a
buffer of actual zeroes. However because of an omitted update to
'offset' we would only zero out (up to) the first 64M of each range.
nbdcopy defaults to working on blocks of 128M, leaving the second 64M
unzeroed.
This affects only backing filesystems which do not support fallocate
FALLOC_FL_PUNCH_HOLE or FALLOC_FL_ZERO_RANGE, which turns out to be
rare, but it does include some NFS-mounted filesystems which is where
I saw this problem.
Fixes: commit 19184d3eb6356ae3b14da0fbaa9c9bdc7743a448
Thanks: Alex Kalenyuk
(cherry picked from commit 20b23fc9838faeddfd42664a7f497a9b29dc5921)
(cherry picked from commit 3c8d0812e7a7b6a1f9e5cceab7bee6e25b9cd7cd)
---
server/plugins.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/server/plugins.c b/server/plugins.c
index 3c7df0d2..db36ce42 100644
--- a/server/plugins.c
+++ b/server/plugins.c
@@ -807,6 +807,7 @@ plugin_zero (struct context *c,
if (r == -1)
break;
count -= limit;
+ offset += limit;
}
done:
--
2.47.1