From: sashiko-bot@kernel.org
To: "Theodore Ts'o" <tytso@mit.edu>,
"Ext4 Developers List" <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH -v2 20/26] ext4: add KUnit tests for fs/ext4/indirect.c
Date: Thu, 19 Nov 2026 16:16:59 +0000 [thread overview]
Message-ID: <sashiko-outbox-223504@kernel.org> (raw)
In-Reply-To: <20261119155658.1940864-21-tytso@mit.edu>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] ext4: leak of test inode and handle on KUNIT_ASSERT abort in
indirect-test.c
--
commit ac1d07e8010829fce0fd4a0596e2f92e79885c99
Author: Theodore Ts'o <tytso@mit.edu>
ext4: add KUnit tests for fs/ext4/indirect.c
This commit adds the ext4_indirect_test KUnit test suite covering legacy
indirect block mapping, truncation, and hole punching in fs/ext4/indirect.c.
> diff --git a/fs/ext4/indirect-test.c b/fs/ext4/indirect-test.c
> new file mode 100644
> index 0000000000000..8d4a430ecb272
> --- /dev/null
> +++ b/fs/ext4/indirect-test.c
[ ... ]
> +static __le32 *ind_blk_ptrs(struct kunit *test, ext4_fsblk_t blk)
> +{
> + struct ind_test_ctx *ctx = test->priv;
> + struct buffer_head *bh;
> +
> + bh = ind_get_or_create_bh(ctx, blk);
> + KUNIT_ASSERT_NOT_NULL(test, bh);
> + brelse(bh);
> + return (__le32 *)bh->b_data;
> +}
> +
> +static struct inode *ind_make_test_inode(struct kunit *test, unsigned long ino)
> +{
> + struct ind_test_ctx *ctx = test->priv;
> + struct inode *inode;
> +
> + inode = new_inode(ctx->sb);
> + KUNIT_ASSERT_NOT_NULL(test, inode);
> + inode->i_ino = ino;
> + inode->i_mode = S_IFREG | 0644;
> + inode->i_blkbits = IND_TEST_BLK_BITS;
> + inode->i_flags |= S_NOQUOTA;
> + EXT4_I(inode)->i_block_group = 0;
> + return inode;
> +}
[ ... ]
> +static void test_ind_remove_space_levels_and_convergence(struct kunit *test)
> +{
> + struct ind_test_ctx *ctx = test->priv;
> + struct inode *inode = ind_make_test_inode(test, 17);
> + __le32 *ind, *dind, *c0, *c1, *c2;
> + handle_t *handle;
> + unsigned int i;
> + int ret;
> +
> + handle = ext4_journal_start(inode, EXT4_HT_TRUNCATE, 8);
> + KUNIT_ASSERT_FALSE(test, IS_ERR(handle));
[ ... ]
> + EXT4_I(inode)->i_data[EXT4_IND_BLOCK] = cpu_to_le32(510);
> + ind = ind_blk_ptrs(test, 510);
[Severity: Low]
Can a KUNIT_ASSERT_* failure after ind_make_test_inode() or
ext4_journal_start() leak the test inode and journal handle?
If ind_get_or_create_bh() fails inside ind_blk_ptrs() (or in
test_ind_map_blocks_errors_and_alloc_branch_unwind()), or if
ext4_journal_start() fails after ind_make_test_inode(), the test aborts
before reaching ext4_journal_stop() and iput(). That leaves the no-journal
handle in current->journal_info with memalloc_nofs_save() active on the
KUnit runner thread, and leaves an active inode on ctx->sb->s_inodes when
ind_test_cleanup() calls deactivate_super(sb). Registering KUnit cleanup
actions for the inode (as in migrate_make_test_inode()) and handle, or
releasing them before aborting, would avoid this.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261119155658.1940864-1-tytso@mit.edu?part=20
next prev parent reply other threads:[~2026-11-19 16:17 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
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 [this message]
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-223504@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.