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>
{
ext2_filsys fs = ff->fs;
blk64_t blk;
- off_t residue;
+ off_t residue = FUSE2FS_OFF_IN_FSB(ff, offset);
int retflags;
errcode_t err;
- residue = FUSE2FS_OFF_IN_FSB(ff, offset);
- if (residue == 0)
- return 0;
-
if (!*buf) {
err = ext2fs_get_mem(fs->blocksize, buf);
if (err)