Skip to contentSkip to conversation

linux-next: test failure in the origin tree

PATCH Mark Brown 2 participants 5 messages Nov 25

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author maintainer
#0 lore raw

Hi all,

There is a KUnit failure in the initial build of Linus' tree today:

$ qemu-system-aarch64 -nodefaults -m 1024 -kernel /tmp/next/arm64_kunit/arch/arm64/boot/Image.gz -append 'kunit.enable=1 console=ttyAMA0 kunit_shutdown=reboot' -no-reboot -nographic -accel kvm -accel hvf -accel tcg -serial stdio -machine virt -cpu max
[12:33:00] ============================================================
[12:33:00] ============== ext4_inode_test (26 subtests) ===============
[12:33:00] # inode_test_get_inode_loc_variants: ASSERTION FAILED at fs/ext4/inode-test.c:1846
[12:33:00] Expected err == 0, but
[12:33:00]     err == -11 (0xfffffffffffffff5)
[12:33:00] [FAILED] inode_test_get_inode_loc_variants
[12:33:00] # inode_test_write_and_sync_metadata: EXPECTATION FAILED at fs/ext4/inode-test.c:3335
[12:33:00] Expected err == -5, but
[12:33:00]     err == 0 (0x0)
[12:33:00] [FAILED] inode_test_write_and_sync_metadata
[12:33:00]     # module: ext4_test
[12:33:00] # ext4_inode_test: pass:24 fail:2 skip:0 total:26
[12:33:00] # Totals: pass:39 fail:2 skip:0 total:41
[12:33:00] ================= [FAILED] ext4_inode_test =================
[12:33:00] ============================================================
[12:33:00] Testing complete. Ran 10052 tests: passed: 9940, failed: 2, skipped: 110

This is happening repeatedly on actual hardware (ie, -accel kvm is operative). This will have been caused by some aspect of the ext4 merge that's tip of tree, the new tests were added in 3ca8192f79504 (ext4:
expand KUnit tests for fs/ext4/inode.c) but I'm not sure if they're identifying actual issues. These were in -next yesterday and did not cause any issues there so it seems likely they're flagging a real issue that's fixed somewhere like the vfs-brauner fixes tree which would have been merged first.

I have applied the below obvious bodge just deleting the tests.

From 2401f8bbde5c03d43978ee1bb92e2073abecb81a Mon Sep 17 00:00:00 2001
From: Mark Brown <[email protected]>
Date: Wed, 25 Nov 2026 12:49:36 +0000
Subject: [PATCH] ext4: Skip broken tests

[12:42:22] ============================================================ [12:42:22] ============== ext4_inode_test (26 subtests) =============== [12:42:22] # inode_test_get_inode_loc_variants: ASSERTION FAILED at fs/ext4/inode-test.c:1846 [12:42:22] Expected err == 0, but
[12:42:22] err == -11 (0xfffffffffffffff5)
[12:42:22] [FAILED] inode_test_get_inode_loc_variants
[12:42:22] # inode_test_write_and_sync_metadata: EXPECTATION FAILED at fs/ext4/inode-test.c:3335 [12:42:22] Expected err == -5, but
[12:42:22] err == 0 (0x0)
[12:42:22] [FAILED] inode_test_write_and_sync_metadata
[12:42:22] # module: ext4_test
[12:42:22] # ext4_inode_test: pass:24 fail:2 skip:0 total:26
[12:42:22] # Totals: pass:39 fail:2 skip:0 total:41
[12:42:22] ================= [FAILED] ext4_inode_test ================= [12:42:22] ============================================================ [12:42:22] Testing complete. Ran 10052 tests: passed: 9940, failed: 2, skipped: 110

---
 fs/ext4/inode-test.c | 158 -------------------------------------------
 1 file changed, 158 deletions(-)
fs/ext4/inode-test.c +0 -158
index ab1ca59826aaf..40cf1a5f8624b 100644
@@ -1799,105 +1799,6 @@ static void inode_test_expand_extra_isize(struct kunit *test)
  * -------------------------------------------------------------------------
  */
 
-static void inode_test_get_inode_loc_variants(struct kunit *test)
-{
-	struct inode_test_ctx *ctx = inode_test_setup(test);
-	struct inode *inode = &ctx->ei.vfs_inode;
-	struct inode_test_blk *itable = inode_test_find_blk(ctx,
-							   INODE_TEST_ITABLE_BLK0);
-	struct inode_test_blk *ibitmap = inode_test_find_blk(ctx,
-							    INODE_TEST_IBITMAP_BLK);
-	struct ext4_iloc iloc = {};
-	struct ext4_inode *raw;
-	int err;
-
-	/* Out-of-range inode numbers */
-	inode->i_ino = 1;
-	KUNIT_EXPECT_EQ(test, ext4_get_inode_loc(inode, &iloc), -EFSCORRUPTED);
-	KUNIT_EXPECT_EQ(test, ext4_get_inode_loc_noio(inode, &iloc),
-			-EFSCORRUPTED);
-	KUNIT_EXPECT_EQ(test, ext4_get_fc_inode_loc(ctx->sb, 99999, &iloc),
-			-EFSCORRUPTED);
-	inode->i_ino = INODE_TEST_PRIMARY_INO;
-
-	/* Missing group descriptor -> -EIO */
-	ctx->fail_group_desc = true;
-	KUNIT_EXPECT_EQ(test, ext4_get_inode_loc(inode, &iloc), -EIO);
-	KUNIT_EXPECT_EQ(test, ext4_get_inode_loc_noio(inode, &iloc), -EIO);
-	ctx->fail_group_desc = false;
-
-	/* Invalid inode table block in group descriptor -> -EFSCORRUPTED */
-	ext4_inode_table_set(ctx->sb, &ctx->gdp, 1);
-	KUNIT_EXPECT_EQ(test, ext4_get_inode_loc(inode, &iloc), -EFSCORRUPTED);
-	KUNIT_EXPECT_EQ(test, ext4_get_inode_loc_noio(inode, &iloc),
-			-EFSCORRUPTED);
-	ext4_inode_table_set(ctx->sb, &ctx->gdp, INODE_TEST_ITABLE_BLK0);
-
-	/* noio variant: uncached -> -EAGAIN, non-uptodate -> -EAGAIN, hit -> 0 */
-	itable->in_cache = false;
-	KUNIT_EXPECT_EQ(test, ext4_get_inode_loc_noio(inode, &iloc), -EAGAIN);
-	itable->in_cache = true;
-	clear_buffer_uptodate(&itable->bh);
-	KUNIT_EXPECT_EQ(test, ext4_get_inode_loc_noio(inode, &iloc), -EAGAIN);
-	KUNIT_EXPECT_EQ(test, atomic_read(&itable->bh.b_count), 1);
-
-	set_buffer_uptodate(&itable->bh);
-	err = ext4_get_inode_loc_noio(inode, &iloc);
-	KUNIT_ASSERT_EQ(test, err, 0);
-	KUNIT_EXPECT_EQ(test, iloc.offset,
-			(unsigned long)((INODE_TEST_PRIMARY_INO - 1) *
-					INODE_TEST_INODE_SIZE));
-	brelse(iloc.bh);
-
-	/*
-	 * Skip-I/O optimization: non-uptodate itable block + uptodate inode
-	 * bitmap with ONLY primary inode bit set -> zero I/O reads!
-	 */
-	clear_buffer_uptodate(&itable->bh);
-	memset(itable->disk_buf, 0x77, INODE_TEST_BLK_SIZE);
-	memset(ibitmap->cache_buf, 0, INODE_TEST_BLK_SIZE);
-	ext4_set_bit(INODE_TEST_PRIMARY_INO - 1, ibitmap->cache_buf);
-	set_buffer_uptodate(&ibitmap->bh);
-	ctx->read_nowait_calls = 0;
-	i_uid_write(inode, 0x4242);
-
-	err = ext4_get_inode_loc(inode, &iloc);
-	KUNIT_ASSERT_EQ(test, err, 0);
-	KUNIT_EXPECT_EQ(test, ctx->read_nowait_calls, 0U);
-	raw = ext4_raw_inode(&iloc);
-	KUNIT_EXPECT_EQ(test, le16_to_cpu(raw->i_uid_low), 0x4242);
-	/* Neighbor slot was zeroed rather than read from 0x77 disk_buf */
-	KUNIT_EXPECT_EQ(test, (u8)itable->cache_buf[0], 0);
-	brelse(iloc.bh);
-
-	/*
-	 * Neighbor inode bit also set in bitmap -> cannot skip I/O; performs
-	 * disk read and triggers inode table readahead window calculation.
-	 */
-	clear_buffer_uptodate(&itable->bh);
-	ext4_set_bit(INODE_TEST_PRIMARY_INO, ibitmap->cache_buf);
-	ctx->sbi.s_inode_readahead_blks = 4;
-	ctx->read_nowait_calls = 0;
-	ctx->readahead_calls = 0;
-
-	err = ext4_get_inode_loc(inode, &iloc);
-	KUNIT_ASSERT_EQ(test, err, 0);
-	KUNIT_EXPECT_EQ(test, ctx->read_nowait_calls, 1U);
-	KUNIT_EXPECT_GT(test, ctx->readahead_calls, 0U);
-	KUNIT_EXPECT_EQ(test, ctx->first_readahead_blk,
-			(ext4_fsblk_t)INODE_TEST_ITABLE_BLK0);
-	KUNIT_EXPECT_EQ(test, (u8)itable->cache_buf[0], 0x77);
-	brelse(iloc.bh);
-	ctx->sbi.s_inode_readahead_blks = 0;
-
-	/* Disk read -EIO propagates cleanly with balanced bh refcount */
-	clear_buffer_uptodate(&itable->bh);
-	ctx->fail_read_eio = true;
-	err = ext4_get_fc_inode_loc(ctx->sb, INODE_TEST_PRIMARY_INO, &iloc);
-	ctx->fail_read_eio = false;
-	KUNIT_EXPECT_EQ(test, err, -EIO);
-	KUNIT_EXPECT_EQ(test, atomic_read(&itable->bh.b_count), 1);
-}
 
 /* -------------------------------------------------------------------------
  * 8. __ext4_iget() Valid Modes, Caching, & Special Inode Tests
@@ -3278,63 +3179,6 @@ static void inode_test_punch_hole_and_truncate(struct kunit *test)
  * -------------------------------------------------------------------------
  */
 
-static void inode_test_write_and_sync_metadata(struct kunit *test)
-{
-	struct inode_test_ctx *ctx = inode_test_setup(test);
-	struct inode *inode = &ctx->ei.vfs_inode;
-	struct inode_test_blk *itable = inode_test_find_blk(ctx,
-							   INODE_TEST_ITABLE_BLK0);
-	struct writeback_control wbc = { .sync_mode = WB_SYNC_ALL };
-	struct ext4_inode *raw;
-	int err;
-
-	/* 1. ext4_inode_attach_jinode(): no-op without journal, allocs with */
-	KUNIT_EXPECT_EQ(test, ext4_inode_attach_jinode(inode), 0);
-	KUNIT_EXPECT_NULL(test, ctx->ei.jinode);
-
-	ctx->sbi.s_journal = (journal_t *)1;
-	err = ext4_inode_attach_jinode(inode);
-	KUNIT_EXPECT_EQ(test, err, 0);
-	KUNIT_EXPECT_NOT_NULL(test, ctx->ei.jinode);
-	/* Idempotent when jinode is already attached */
-	KUNIT_EXPECT_EQ(test, ext4_inode_attach_jinode(inode), 0);
-	ctx->sbi.s_journal = NULL;
-	if (ctx->ei.jinode) {
-		jbd2_free_inode(ctx->ei.jinode);
-		ctx->ei.jinode = NULL;
-	}
-
-	/* 2. ext4_write_inode(): 0 in nojournal, -EROFS in emergency state */
-	KUNIT_EXPECT_EQ(test, ext4_write_inode(inode, &wbc), 0);
-	set_bit(EXT4_FLAGS_EMERGENCY_RO, &ctx->sbi.s_ext4_flags);
-	KUNIT_EXPECT_EQ(test, ext4_write_inode(inode, &wbc), -EROFS);
-	clear_bit(EXT4_FLAGS_EMERGENCY_RO, &ctx->sbi.s_ext4_flags);
-
-	/* 3. ext4_sync_inode_metadata(): warns & fails if journal present */
-	ctx->sbi.s_journal = (journal_t *)1;
-	kunit_warning_suppress(test) {
-		err = ext4_sync_inode_metadata(inode, &wbc);
-	}
-	ctx->sbi.s_journal = NULL;
-	KUNIT_EXPECT_EQ(test, err, -EFSCORRUPTED);
-
-	/* Clean nojournal metadata sync flushes dirty raw inode & returns 0 */
-	i_uid_write(inode, 0x7788);
-	ext4_dirty_inode(inode, I_DIRTY_SYNC);
-	clear_buffer_mapped(&itable->bh);
-	clear_buffer_write_io_error(&itable->bh);
-	err = ext4_sync_inode_metadata(inode, &wbc);
-	KUNIT_EXPECT_EQ(test, err, 0);
-	raw = inode_test_raw_slot(ctx, INODE_TEST_PRIMARY_INO, false);
-	KUNIT_EXPECT_EQ(test, le16_to_cpu(raw->i_uid_low), 0x7788);
-
-	/* Simulated buffer write error returns -EIO */
-	set_buffer_write_io_error(&itable->bh);
-	err = ext4_sync_inode_metadata(inode, &wbc);
-	clear_buffer_write_io_error(&itable->bh);
-	KUNIT_EXPECT_EQ(test, err, -EIO);
-}
-
 /* -------------------------------------------------------------------------
  * 22. ext4_evict_inode() Live, Unlinked Regular & Fast Symlink Eviction Tests
  * -------------------------------------------------------------------------
@@ -3750,7 +3594,6 @@ static struct kunit_case ext4_inode_test_cases[] = {
 	KUNIT_CASE(inode_test_fill_raw_inode),
 	KUNIT_CASE(inode_test_mark_dirty_and_update),
 	KUNIT_CASE(inode_test_expand_extra_isize),
-	KUNIT_CASE(inode_test_get_inode_loc_variants),
 	KUNIT_CASE(inode_test_iget_validation_and_modes),
 	KUNIT_CASE(inode_test_iget_corruptions),
 	KUNIT_CASE(inode_test_fast_symlink_and_can_truncate),
@@ -3764,7 +3607,6 @@ static struct kunit_case ext4_inode_test_cases[] = {
 	KUNIT_CASE(inode_test_trans_credits_and_disksize),
 	KUNIT_CASE(inode_test_zero_partial_and_eof),
 	KUNIT_CASE(inode_test_punch_hole_and_truncate),
-	KUNIT_CASE(inode_test_write_and_sync_metadata),
 	KUNIT_CASE(inode_test_evict_inode_paths),
 	KUNIT_CASE(inode_test_buffered_write_and_folio_ops),
 	KUNIT_CASE(inode_test_setattr),
Signature · 1 line
2.47.3
#1 lore raw
Quoted 9 lines · Mark Brown

This is happening repeatedly on actual hardware (ie, -accel kvm is operative). This will have been caused by some aspect of the ext4 merge that's tip of tree, the new tests were added in 3ca8192f79504 (ext4:
expand KUnit tests for fs/ext4/inode.c) but I'm not sure if they're identifying actual issues. These were in -next yesterday and did not cause any issues there so it seems likely they're flagging a real issue that's fixed somewhere like the vfs-brauner fixes tree which would have been merged first.

Well, it could be me having messed up the merge itself. There were a few conflicts - but I was being careful and they did look quite straightforward despite my annoyance at the timing of seeing those kinds of conflicts.

So I _think_ the merge is fine, and judging by the actual failure reports (eg inode_test_write_and_sync_metadata()) it is because the tests are testing things that were fixed by commit d25c14b2d79e ("ext4: use sb_find_get_block_nonatomic() in ext4_get_inode_loc_noio()")

Linus

author maintainer
#2 lore raw
Quoted 11 lines · Linus Torvalds
Quoted 8 lines · Mark Brown

This is happening repeatedly on actual hardware (ie, -accel kvm is operative). This will have been caused by some aspect of the ext4 merge that's tip of tree, the new tests were added in 3ca8192f79504 (ext4:
expand KUnit tests for fs/ext4/inode.c) but I'm not sure if they're identifying actual issues. These were in -next yesterday and did not cause any issues there so it seems likely they're flagging a real issue that's fixed somewhere like the vfs-brauner fixes tree which would have been merged first.

Quoted 4 lines

Well, it could be me having messed up the merge itself. There were a few conflicts - but I was being careful and they did look quite straightforward despite my annoyance at the timing of seeing those kinds of conflicts.

It's definitely possible of course. Probably worth mentioning that what you've pulled in was the main ext4 development tree yesterday, not the ext4 fixes tree which was still at the previously merged 8c4f6e3376348 ("ext4: introduce a mount option for iomap buffered I/O path") which makes direct comparisons a bit wonky. What came in during yesterday's merge was never in -next as a fixes branch so didn't hit fs-current or pending-fixes.

Quoted 5 lines

So I _think_ the merge is fine, and judging by the actual failure reports (eg inode_test_write_and_sync_metadata()) it is because the tests are testing things that were fixed by commit d25c14b2d79e ("ext4: use sb_find_get_block_nonatomic() in ext4_get_inode_loc_noio()")

That commit was in your tree before the ext4 changes (the ext4 changes were the top commit in your tree today, I nearly just rolled your tree back by a commit) so I'd have thought that if the tests were verifying those changes then they'd pass? Possibly something from vfs-brauner, it looks like Al's not updated his tree since June?

author maintainer
#3 lore raw
Quoted 7 lines · Mark Brown
Quoted 4 lines · Linus Torvalds

Well, it could be me having messed up the merge itself. There were a few conflicts - but I was being careful and they did look quite straightforward despite my annoyance at the timing of seeing those kinds of conflicts.

Quoted 7 lines

It's definitely possible of course. Probably worth mentioning that what you've pulled in was the main ext4 development tree yesterday, not the ext4 fixes tree which was still at the previously merged 8c4f6e3376348 ("ext4: introduce a mount option for iomap buffered I/O path") which makes direct comparisons a bit wonky. What came in during yesterday's merge was never in -next as a fixes branch so didn't hit fs-current or pending-fixes.

Inspecting the diffs with the various versions and testing quickly I think you need:

fs/ext4/inode-test.c +2 -0
index ab1ca59826aaf..529cab24db48f 100644
@@ -1149,6 +1149,8 @@ static struct inode_test_ctx *inode_test_setup(struct kunit *test)
 				   inode_test_sb_getblk_stub);
 	kunit_activate_static_stub(test, ext4_sb_find_get_block,
 				   inode_test_sb_find_get_block_stub);
+	kunit_activate_static_stub(test, ext4_sb_find_get_block_nonatomic,
+				   inode_test_sb_find_get_block_stub);
 	kunit_activate_static_stub(test, ext4_sb_getblk_unmovable,
 				   inode_test_sb_getblk_unmovable_stub);
 	kunit_activate_static_stub(test, ext4_ext_getblk,
#4 lore raw
Quoted 3 lines · Mark Brown

Inspecting the diffs with the various versions and testing quickly I think you need:

That looks right. Except I think the pattern there is that it should create a nonatomic stub, and activate *that*, and then call that generic stub from there.

At least going by inode_test_sb_getblk_unmovable_stub()..

But I'll leave this for Ted, since I'm not actually *running* the tests, so I'll stop making fixes based on what I think the pattern matching should be.

Ted?

Linus