From: "Darrick J. Wong" <djwong@kernel.org>
To: tytso@mit.edu
Cc: linux-ext4@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: [PATCH 1/3] libext2fs: fix spurious warnings from fallocate
Date: Wed, 11 Jun 2025 09:43:45 -0700 [thread overview]
Message-ID: <174966018070.3972888.9575426474425493201.stgit@frogsfrogsfrogs> (raw)
In-Reply-To: <174966018041.3972888.391896904012834159.stgit@frogsfrogsfrogs>
From: Darrick J. Wong <djwong@kernel.org>
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>
---
lib/ext2fs/fallocate.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/ext2fs/fallocate.c b/lib/ext2fs/fallocate.c
index 5cde7d5c2dc28b..063242c5fa4e6b 100644
--- a/lib/ext2fs/fallocate.c
+++ b/lib/ext2fs/fallocate.c
@@ -276,6 +276,11 @@ static errcode_t ext_falloc_helper(ext2_filsys fs,
max_uninit_len : max_init_len))
goto try_left;
+ /* Would they even be physically contiguous if merged? */
+ if (left_ext->e_pblk + left_ext->e_len + range_len !=
+ right_ext->e_pblk)
+ goto try_left;
+
err = ext2fs_extent_goto(handle, left_ext->e_lblk);
if (err)
goto try_left;
next prev parent reply other threads:[~2025-06-11 16:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-11 16:43 [PATCHSET] fuse2fs: more bug fixes Darrick J. Wong
2025-06-11 16:43 ` Darrick J. Wong [this message]
2025-06-11 16:44 ` [PATCH 2/3] fuse2fs: fix error bailout in op_create Darrick J. Wong
2025-06-11 16:44 ` [PATCH 3/3] fuse2fs: catch positive errnos coming from libext2fs Darrick J. Wong
2025-06-12 16:43 ` Theodore Ts'o
2025-06-12 22:15 ` Darrick J. Wong
2025-06-13 2:04 ` Theodore Ts'o
2025-06-12 22:18 ` [PATCH 4/3] libext2fs: fix bounding error in the extent fallocate code Darrick J. Wong
2025-06-13 1:06 ` [PATCHSET] fuse2fs: more bug fixes Theodore Ts'o
2025-06-14 17:35 ` Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=174966018070.3972888.9575426474425493201.stgit@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox