Re: [PATCH 1/4] test-ww_mutex: Fix module cleanup
From: John Stultz
Date: Thu Jun 18 2026 - 13:49:57 EST
On Wed, Jun 17, 2026 at 5:13 AM Håkon Bugge <haakon.bugge@xxxxxxxxxx> wrote:
>
> When test-ww_mutex is compiled as a module, there are two bugs. One is
> related to the case where the module fails to load. In that case, some
> or all of the allocated objects are not released. Also, if loaded OK
> and thereafter unloaded, the sysfs file is not removed.
>
> The latter bug gives the following splat (trimmed for better brevity):
>
> sysfs: cannot create duplicate filename '/kernel/test_ww_mutex'
> dump_stack_lvl+0x5d/0x90
> sysfs_warn_dup.cold+0x17/0x23
> sysfs_create_dir_ns+0xe2/0x100
> kobject_add_internal+0xba/0x270
> kobject_add+0x95/0xd0
> kobject_create_and_add+0xa3/0xd0
> test_ww_mutex_init+0x90/0xff0 [test_ww_mutex]
> do_one_initcall+0x5c/0x330
> do_init_module+0x90/0x290
> __do_sys_init_module+0x195/0x1d0
> do_syscall_64+0xe8/0x550
> entry_SYSCALL_64_after_hwframe+0x76/0x7e
>
> Fixes: 2a0c11282881 ("locking/ww_mutex: Add kselftests for ww_mutex stress")
> Fixes: de2c5a1523fd ("test-ww_mutex: Allow test to be run (and re-run) from userland")
> Signed-off-by: Håkon Bugge <haakon.bugge@xxxxxxxxxx>
Ah! Thanks for sending this!
Acked-by: John Stultz <jstultz@xxxxxxxxxx>