From: sashiko-bot@kernel.org
To: "Theodore Ts'o" <tytso@mit.edu>,
"Ext4 Developers List" <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH -v2 02/26] ext4: add KUnit tests for fs/ext4/extents.c
Date: Thu, 19 Nov 2026 16:19:04 +0000 [thread overview]
Message-ID: <sashiko-outbox-223509@kernel.org> (raw)
In-Reply-To: <20261119155658.1940864-3-tytso@mit.edu>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] ext4: extent loss in ext4_ext_split() after dropping
__GFP_NOFAIL
--
commit ebd19bc1cdea3cf4f65a39e530d43e87d087d855
Author: Theodore Ts'o <tytso@mit.edu>
ext4: add KUnit tests for fs/ext4/extents.c
This commit expands the ext4_extents_test KUnit test suite to cover extent
tree operations in fs/ext4/extents.c and adds KUnit static stub redirects
and symbol exports for testing.
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index aa65aca4a1ead..0a442844b954e 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
[ ... ]
> @@ -1212,7 +1219,7 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode,
> while (k--) {
> oldblock = newblock;
> newblock = ablocks[--a];
> - bh = sb_getblk(inode->i_sb, newblock);
> + bh = ext4_ext_getblk(inode, newblock, __GFP_MOVABLE | GFP_NOFS);
> if (unlikely(!bh)) {
> err = -ENOMEM;
> goto cleanup;
[Severity: Medium]
Can replacing sb_getblk() (which passes __GFP_NOFAIL) with
ext4_ext_getblk(..., __GFP_MOVABLE | GFP_NOFS) lose the m split extents if
this allocation fails?
By the time ext4_ext_split() enters the intermediate index loop, the m
extents have been moved to the new leaf block in ablocks[] and the old
leaf has already had its eh_entries decremented in place and dirtied:
fs/ext4/extents.c:ext4_ext_split() {
...
/* correct old leaf */
if (m) {
err = ext4_ext_get_access(handle, inode, path + depth);
if (err)
goto cleanup;
le16_add_cpu(&path[depth].p_hdr->eh_entries, -m);
err = ext4_ext_dirty(handle, inode, path + depth);
if (err)
goto cleanup;
}
...
}
Jumping to cleanup on -ENOMEM frees all blocks in ablocks[] (including the
new leaf block holding those m extents) without restoring
path[depth].p_hdr->eh_entries, leaving the old leaf truncated in the
running transaction. Passing __GFP_NOFAIL here as sb_getblk() did would
avoid failing after the old leaf has been modified.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261119155658.1940864-1-tytso@mit.edu?part=2
next prev parent reply other threads:[~2026-11-19 16:19 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 15:56 [PATCH -v2 00/26] ext4: add lots of KUnit tests! Theodore Ts'o
2026-11-19 15:56 ` [PATCH -v2 01/26] ext4: add KUinit tests for fs/ext4/extents_status.c Theodore Ts'o
2026-11-19 16:05 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 02/26] ext4: add KUnit tests for fs/ext4/extents.c Theodore Ts'o
2026-11-19 16:19 ` sashiko-bot [this message]
2026-11-19 15:56 ` [PATCH -v2 03/26] ext4: add KUnit tests for fs/ext4/xattr.c Theodore Ts'o
2026-11-19 16:11 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 04/26] ext4: add KUnit tests for fs/ext4/namei.c Theodore Ts'o
2026-11-19 16:11 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 05/26] ext4: expand KUnit tests for fs/ext4/mballoc.c Theodore Ts'o
2026-11-19 16:08 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 06/26] ext4: add KUnit tests for fs/ext4/inline.c Theodore Ts'o
2026-11-19 16:07 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 07/26] ext4: add KUnit tests for fs/ext4/fast_commit.c Theodore Ts'o
2026-11-19 16:07 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 08/26] ext4: expand KUnit tests for fs/ext4/inode.c Theodore Ts'o
2026-11-19 16:07 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 09/26] ext4: add KUnit tests for fs/ext4/ialloc.c Theodore Ts'o
2026-11-19 16:13 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 10/26] ext4: add KUnit tests for fs/ext4/balloc.c Theodore Ts'o
2026-11-19 16:06 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 11/26] ext4: add KUnit tests for fs/ext4/orphan.c Theodore Ts'o
2026-11-19 16:07 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 12/26] ext4: add KUnit tests for fs/ext4/block_validity.c Theodore Ts'o
2026-11-19 16:12 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 13/26] ext4: check multi-block overlap on left traversal in add_system_zone() Theodore Ts'o
2026-11-19 16:00 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 14/26] ext4: enable full feature coverage in fs/ext4/.kunitconfig Theodore Ts'o
2026-11-19 16:12 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 15/26] ext4: add KUnit tests for fs/ext4/super.c Theodore Ts'o
2026-11-19 16:07 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 16/26] ext4: add KUnit tests for fs/ext4/sysfs.c Theodore Ts'o
2026-11-19 16:08 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 17/26] ext4: add KUnit tests for fs/ext4/ioctl.c Theodore Ts'o
2026-11-19 16:12 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 18/26] ext4: add KUnit tests for fs/ext4/resize.c Theodore Ts'o
2026-11-19 16:16 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 19/26] ext4: add KUnit tests for fs/ext4/migrate.c Theodore Ts'o
2026-11-19 16:11 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 20/26] ext4: add KUnit tests for fs/ext4/indirect.c Theodore Ts'o
2026-11-19 16:16 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 21/26] ext4: expand KUnit tests in fs/ext4/extents-test.c for file range operations Theodore Ts'o
2026-11-19 16:12 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 22/26] ext4: add KUnit tests for fs/ext4/fsmap.c Theodore Ts'o
2026-11-19 16:13 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 23/26] ext4: add KUnit tests for fs/ext4/move_extent.c Theodore Ts'o
2026-11-19 16:14 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 24/26] ext4: add KUnit tests for fs/ext4/mmp.c Theodore Ts'o
2026-11-19 16:12 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 25/26] ext4: add KUnit tests for fs/ext4/dir.c Theodore Ts'o
2026-11-19 16:17 ` sashiko-bot
2026-11-19 15:56 ` [PATCH -v2 26/26] ext4: add KUnit regression tests for inode migration fixes Theodore Ts'o
2026-11-19 16:15 ` sashiko-bot
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=sashiko-outbox-223509@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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