]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit
fuse2fs: fix clean_block_middle when punching byte 0 of a block
authorDarrick J. Wong <djwong@kernel.org>
Thu, 31 Jul 2025 14:43:50 +0000 (10:43 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 31 Jul 2025 14:43:50 +0000 (10:43 -0400)
commit9b44c01c1f9d800a56bb7a01a53e4f318c08d9f2
treea82073222d7996d2ba8e9b157fd2ad44921eab6e
parentbc599a8bf3d448a12d14e9b2f2f1618600c2daa1
fuse2fs: fix clean_block_middle when punching byte 0 of a block

In non-iomap mode, generic/008 tries to fzero the first byte of a block
and fails:

--- a/tests/generic/008.out      2025-07-15 14:45:14.937058680 -0700
+++ b/tests/generic/008.out.bad        2025-07-16 11:43:42.427989360 -0700
@@ -4,8 +4,7 @@
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 1024/1024 bytes at offset 1024
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-00000000:  00 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41  .AAAAAAAAAAAAAAA
-00000010:  41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41  AAAAAAAAAAAAAAAA
+00000000:  41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41  AAAAAAAAAAAAAAAA
 *
 00000400:  42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42  BBBBBBBBBBBBBBBB
 *

Here we can clearly see that the first byte of the block has not been
zeroed, even though that's what the caller wanted us to do.  This is due
to an incorrect check of the residue variable that was most likely copy
pasted from clean_block_edge years ago.

Cc: linux-ext4@vger.kernel.org # v1.43
Fixes: 81cbf1ef4f5dab ("misc: add fuse2fs, a FUSE server for e2fsprogs")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
misc/fuse2fs.c