Re: [syzbot] [kernel] WARNING: locking bug in try_to_wake_up

From: Hillf Danton
Date: Mon Sep 30 2024 - 21:50:11 EST


On Mon, 30 Sep 2024 16:39:29 -0700
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 9852d85ec9d4 Linux 6.12-rc1
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13ad839f980000

#syz test

--- x/fs/btrfs/disk-io.c
+++ y/fs/btrfs/disk-io.c
@@ -4315,9 +4315,6 @@ void __cold close_ctree(struct btrfs_fs_
if (BTRFS_FS_ERROR(fs_info))
btrfs_error_commit_super(fs_info);

- kthread_stop(fs_info->transaction_kthread);
- kthread_stop(fs_info->cleaner_kthread);
-
ASSERT(list_empty(&fs_info->delayed_iputs));
set_bit(BTRFS_FS_CLOSING_DONE, &fs_info->flags);

@@ -4349,6 +4346,8 @@ void __cold close_ctree(struct btrfs_fs_
*/
invalidate_inode_pages2(fs_info->btree_inode->i_mapping);
btrfs_stop_all_workers(fs_info);
+ kthread_stop(fs_info->transaction_kthread);
+ kthread_stop(fs_info->cleaner_kthread);

/* We shouldn't have any transaction open at this point */
warn_about_uncommitted_trans(fs_info);
--