]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ext4: fix miss unlock 'sb->s_umount' in extents_kunit_init()
authorYe Bin <yebin10@huawei.com>
Mon, 30 Mar 2026 13:30:31 +0000 (21:30 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 10 Apr 2026 02:04:32 +0000 (22:04 -0400)
There's warning as follows when do ext4 kunit test:
WARNING: kunit_try_catch/15923 still has locks held!
7.0.0-rc3-next-20260309-00028-g73f965a1bbb1-dirty #281 Tainted: G            E    N
1 lock held by kunit_try_catch/15923:
 #0: ffff888139f860e0 (&type->s_umount_key#70/1){+.+.}-{4:4}, at: alloc_super.constprop.0+0x172/0xa90
Call Trace:
 <TASK>
 dump_stack_lvl+0x180/0x1b0
 debug_check_no_locks_held+0xc8/0xd0
 do_exit+0x1502/0x2b20
 kthread+0x3a9/0x540
 ret_from_fork+0xa76/0xdf0
 ret_from_fork_asm+0x1a/0x30

As sget() will return 'sb' which holds 's->s_umount' lock. However,
"extents-test" miss unlock this lock.
So unlock 's->s_umount' in the end of extents_kunit_init().

Fixes: cb1e0c1d1fad ("ext4: kunit tests for extent splitting and conversion")
Signed-off-by: Ye Bin <yebin10@huawei.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Link: https://patch.msgid.link/20260330133035.287842-2-yebin@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/extents-test.c

index 5496b2c8e2cd3aff217f57ac7138951660657751..82c59291e0458ce7f757ca99120a423ee978300c 100644 (file)
@@ -309,6 +309,8 @@ static int extents_kunit_init(struct kunit *test)
        kunit_activate_static_stub(test, ext4_ext_zeroout, ext4_ext_zeroout_stub);
        kunit_activate_static_stub(test, ext4_issue_zeroout,
                                   ext4_issue_zeroout_stub);
+       up_write(&sb->s_umount);
+
        return 0;
 }