nbdkit/SOURCES/0006-server-Fix-.zero-fallback-path.patch

40 lines
1.1 KiB
Diff

From 254edc8b3b8d67a952919a32e7aea0e1e8c26b78 Mon Sep 17 00:00:00 2001
From: Darren Archibald <darren.archibald@oracle.com>
Date: Wed, 6 Aug 2025 03:29:39 -0700
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 19184d3
Thanks: Alex Kalenyuk
Signed-off-by: Darren Archibald <darren.archibald@oracle.com>
---
server/plugins.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/server/plugins.c b/server/plugins.c
index 3c7df0d..db36ce4 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.31.1