--- x/fs/btrfs/disk-io.c +++ y/fs/btrfs/disk-io.c @@ -4316,7 +4316,6 @@ void __cold close_ctree(struct btrfs_fs_ 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 +4348,7 @@ 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->cleaner_kthread); /* We shouldn't have any transaction open at this point */ warn_about_uncommitted_trans(fs_info);