]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit
libext2fs: fix spurious warnings from fallocate
authorDarrick J. Wong <djwong@kernel.org>
Wed, 11 Jun 2025 16:43:45 +0000 (09:43 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 12 Jun 2025 16:57:54 +0000 (14:27 -0230)
commit459efa346874a11b4911809e75d6eee157792ca5
tree791e7db1dfbbde9e2f5fa31f394d9d2861872b8a
parent71f046a788adbae163c9398fccf50fff89bb9083
libext2fs: fix spurious warnings from fallocate

generic/522 routinely produces error messages from fuse2fs like this:

FUSE2FS (sde): Illegal block number passed to ext2fs_test_block_bitmap #9321 for block bitmap for /dev/sde

Curiously, these don't actually result in errors being thrown up to the
kernel.  Digging into the program (which was more difficult than it
needed to be because of the weird bitmap base + errcode weirdness)
produced a left record:

e_lblk = 16
e_pblk = 9293
e_len = 6
e_flags = 0

and a right record:

e_lblk = 45
e_pblk = 9321
e_len = 6
e_flags = 0

Thus we end up in the "Merge both extents together, perhaps?" section of
ext_falloc_helper.  Unfortunately, the merge selection code isn't smart
enough to notice that the two mappings aren't actually physically
contiguous, so it scans the bitmap with a negative length, which is why
the assertion trips.

The simple fix here is not to try to merge the adjacent extents if
they're not actually physically contiguous.

Cc: linux-ext4@vger.kernel.org # v1.43
Fixes: 5aad5b8e0e3cfa ("libext2fs: implement fallocate")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/fallocate.c