Linux EXT4 FS development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Theodore Ts'o" <tytso@mit.edu>,
	"Ext4 Developers List" <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH 03/27] ext4: add KUnit tests for ext4_ext_split() leaf and index splitting
Date: Thu, 12 Nov 2026 04:15:55 +0000	[thread overview]
Message-ID: <sashiko-outbox-210315@kernel.org> (raw)
In-Reply-To: <20261112040638.1576836-4-tytso@mit.edu>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] ext4: unexplained test_swap_extents() changes and stale Fixes
  SHA
--

commit 55141b7904f9009059aca2d2a02dc5c501ed9bde
Author: Theodore Ts'o <tytso@mit.edu>

> ext4: add KUnit tests for ext4_ext_split() leaf and index splitting
>
> Commit 7831b3664109 ("ext4: add KUnit tests for fs/ext4/extents.c")
> updated both block-allocation paths in ext4_ext_split() to call
> ext4_ext_getblk() and noted node splitting in the commit message, but
> none of the test cases in fs/ext4/extents-test.c actually reached
> ext4_ext_split(). In test_insert_extent_grow_and_merge_up(), inserting a
> 5th extent into a full depth-0 root triggers ext4_ext_grow_indepth(),
> moving the 4 extents into an external leaf block with eh_max == 340 and
> returning from ext4_ext_create_new_leaf() without splitting.
>
> Add two KUnit test cases to exercise ext4_ext_split() across leaf and
> intermediate index levels:
>
> - test_insert_extent_leaf_split(): fills a depth-1 external leaf block
>   to capacity (340 extents), inserts in the middle to trigger a leaf
>   split that moves tail extents into a new leaf block, and then fills
>   the second leaf and appends past its end to exercise the m == 0
>   leaf-addition path.
> - test_insert_extent_index_split(): exercises depth 1 -> 2 tree growth
>   followed by leaf splitting via the repeat loop in
>   ext4_ext_create_new_leaf(), and then clamps the depth-1 index block's
>   eh_max to exercise simultaneous leaf and intermediate index block
>   splitting (k == 1) in ext4_ext_split().
>
> Fixes: 7831b3664109 ("ext4: add KUnit tests for fs/ext4/extents.c")
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>

> diff --git a/fs/ext4/extents-test.c b/fs/ext4/extents-test.c
> index 7056481862188..47ddeb94e2bf4 100644
> --- a/fs/ext4/extents-test.c
> +++ b/fs/ext4/extents-test.c

[ ... ]

> @@ -2073,17 +2265,13 @@ static void test_swap_extents(struct kunit *test)
>  	KUNIT_ASSERT_EQ(test, ext_insert_one(inode1, 10, 10, 100, false, 0), 0);
>  	KUNIT_ASSERT_EQ(test, ext_insert_one(inode2, 10, 10, 200, false, 0), 0);
>  
> -	inode_lock(inode1);
> -	inode_lock(inode2);
> -	down_write(&EXT4_I(inode1)->i_data_sem);
> -	down_write(&EXT4_I(inode2)->i_data_sem);
> +	lock_two_nondirectories(inode1, inode2);
> +	ext4_double_down_write_data_sem(inode1, inode2);
>  
>  	replaced = ext4_swap_extents(NULL, inode1, inode2, 12, 12, 5, 1, &err);
>  
> -	up_write(&EXT4_I(inode2)->i_data_sem);
> -	up_write(&EXT4_I(inode1)->i_data_sem);
> -	inode_unlock(inode2);
> -	inode_unlock(inode1);
> +	ext4_double_up_write_data_sem(inode1, inode2);
> +	unlock_two_nondirectories(inode1, inode2);
>  
>  	KUNIT_EXPECT_EQ(test, err, 0);
>  	KUNIT_EXPECT_EQ(test, replaced, 5);

[ ... ]

> diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
> index 3329b7ad5dbd8..d1405e7639128 100644
> --- a/fs/ext4/move_extent.c
> +++ b/fs/ext4/move_extent.c
> @@ -656,3 +656,8 @@ int ext4_move_extents(struct file *o_filp, struct file *d_filp, __u64 orig_blk,
>  	unlock_two_nondirectories(orig_inode, donor_inode);
>  	return ret;
>  }
> +
> +#if IS_ENABLED(CONFIG_EXT4_KUNIT_TESTS)
> +EXPORT_SYMBOL_FOR_EXT4_TEST(ext4_double_down_write_data_sem);
> +EXPORT_SYMBOL_FOR_EXT4_TEST(ext4_double_up_write_data_sem);
> +#endif

[Severity: Low]
This isn't a bug, but the commit message does not mention updating
test_swap_extents() to use lock_two_nondirectories() and
ext4_double_down_write_data_sem() (and exporting those helpers from
fs/ext4/move_extent.c) to avoid lockdep warnings on i_rwsem and
i_data_sem.

Also, the commit message and Fixes: trailer cite a stale pre-rebase sha
for commit "ext4: add KUnit tests for fs/ext4/extents.c" rather than the
parent commit in this branch.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261112040638.1576836-1-tytso@mit.edu?part=3

  reply	other threads:[~2026-11-12  4:15 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  4:06 [PATCH 00/27] ext4: add lots of KUnit tests! Theodore Ts'o
2026-11-12  4:06 ` [PATCH 01/27] ext4: add KUinit tests for fs/ext4/extents_status.c Theodore Ts'o
2026-11-12  4:18   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 02/27] ext4: add KUnit tests for fs/ext4/extents.c Theodore Ts'o
2026-11-12  4:28   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 03/27] ext4: add KUnit tests for ext4_ext_split() leaf and index splitting Theodore Ts'o
2026-11-12  4:15   ` sashiko-bot [this message]
2026-11-12  4:06 ` [PATCH 04/27] ext4: add KUnit tests for fs/ext4/xattr.c Theodore Ts'o
2026-11-12  4:26   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 05/27] ext4: add KUnit tests for fs/ext4/namei.c Theodore Ts'o
2026-11-12  4:21   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 06/27] ext4: expand KUnit tests for fs/ext4/mballoc.c Theodore Ts'o
2026-11-12  4:26   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 07/27] ext4: add KUnit tests for fs/ext4/inline.c Theodore Ts'o
2026-11-12  4:29   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 08/27] ext4: zero s_fc_replay_state in ext4_fc_replay_cleanup() Theodore Ts'o
2026-11-12  4:16   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 09/27] ext4: add KUnit tests for fs/ext4/fast_commit.c Theodore Ts'o
2026-11-12  4:28   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 10/27] ext4: expand KUnit tests for fs/ext4/inode.c Theodore Ts'o
2026-11-12  4:36   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 11/27] ext4: add KUnit tests for fs/ext4/ialloc.c Theodore Ts'o
2026-11-12  4:25   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 12/27] ext4: add KUnit tests for fs/ext4/balloc.c Theodore Ts'o
2026-11-12  4:16   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 13/27] ext4: add KUnit tests for fs/ext4/orphan.c Theodore Ts'o
2026-11-12  4:18   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 14/27] ext4: add KUnit tests for fs/ext4/block_validity.c Theodore Ts'o
2026-11-12  4:21   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 15/27] ext4: check multi-block overlap on left traversal in add_system_zone() Theodore Ts'o
2026-11-12  4:10   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 16/27] ext4: enable full feature coverage in fs/ext4/.kunitconfig Theodore Ts'o
2026-11-12  4:24   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 17/27] ext4: add KUnit tests for fs/ext4/super.c Theodore Ts'o
2026-11-12  4:27   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 18/27] ext4: add KUnit tests for fs/ext4/sysfs.c Theodore Ts'o
2026-11-12  4:32   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 19/27] ext4: add KUnit tests for fs/ext4/ioctl.c Theodore Ts'o
2026-11-12  4:35   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 20/27] ext4: add KUnit tests for fs/ext4/resize.c Theodore Ts'o
2026-11-12  4:34   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 21/27] ext4: add KUnit tests for fs/ext4/migrate.c Theodore Ts'o
2026-11-12  4:37   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 22/27] ext4: add KUnit tests for fs/ext4/indirect.c Theodore Ts'o
2026-11-12  4:46   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 23/27] ext4: expand KUnit tests in fs/ext4/extents-test.c for file range operations Theodore Ts'o
2026-11-12  4:34   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 24/27] ext4: add KUnit tests for fs/ext4/fsmap.c Theodore Ts'o
2026-11-12  4:30   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 25/27] ext4: add KUnit tests for fs/ext4/move_extent.c Theodore Ts'o
2026-11-12  4:36   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 26/27] ext4: add KUnit tests for fs/ext4/mmp.c Theodore Ts'o
2026-11-12  4:29   ` sashiko-bot
2026-11-12  4:06 ` [PATCH 27/27] ext4: add KUnit tests for fs/ext4/dir.c Theodore Ts'o
2026-11-12  4:41   ` 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-210315@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