Kernel bug: INFO: task hung in __alloc_workqueue (2)
Subsystem: btrfs
Status: open

Crash report:
INFO: task syz.3.122:7794 blocked for more than 143 seconds.
      Not tainted syzkaller #0
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:syz.3.122       state:D stack:25608 pid:7794  tgid:7794  ppid:5970   task_flags:0x400140 flags:0x00080003
Call Trace:
 <TASK>
 context_switch kernel/sched/core.c:5325 [inline]
 __schedule+0x16f3/0x4c20 kernel/sched/core.c:6929
 __schedule_loop kernel/sched/core.c:7011 [inline]
 schedule+0x165/0x360 kernel/sched/core.c:7026
 schedule_timeout+0x9a/0x270 kernel/time/sleep_timeout.c:75
 do_wait_for_common kernel/sched/completion.c:100 [inline]
 __wait_for_common kernel/sched/completion.c:121 [inline]
 wait_for_common kernel/sched/completion.c:132 [inline]
 wait_for_completion+0x2bf/0x5d0 kernel/sched/completion.c:153
 kthread_flush_worker+0x1c6/0x240 kernel/kthread.c:1564
 __alloc_workqueue+0x1470/0x1b70 kernel/workqueue.c:5795
 alloc_workqueue_noprof+0xd4/0x210 kernel/workqueue.c:5818
 btrfs_alloc_workqueue+0x1ec/0x2d0 fs/btrfs/async-thread.c:112
 btrfs_init_workqueues+0x62/0x6c0 fs/btrfs/disk-io.c:1964
 open_ctree+0x13bf/0x3cc0 fs/btrfs/disk-io.c:3425
 btrfs_fill_super fs/btrfs/super.c:987 [inline]
 btrfs_get_tree_super fs/btrfs/super.c:1952 [inline]
 btrfs_get_tree_subvol fs/btrfs/super.c:2089 [inline]
 btrfs_get_tree+0xf55/0x1820 fs/btrfs/super.c:2123
 vfs_get_tree+0x92/0x2b0 fs/super.c:1752
 do_new_mount+0x2a2/0xa30 fs/namespace.c:3750
 do_mount fs/namespace.c:4078 [inline]
 __do_sys_mount fs/namespace.c:4278 [inline]
 __se_sys_mount+0x317/0x410 fs/namespace.c:4255
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f4ebdff066a
RSP: 002b:00007ffce39416d8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffce3941760 RCX: 00007f4ebdff066a
RDX: 0000200000000200 RSI: 0000200000005600 RDI: 00007ffce3941720
RBP: 0000200000000200 R08: 00007ffce3941760 R09: 0000000000000800
R10: 0000000000000800 R11: 0000000000000246 R12: 0000200000005600
R13: 00007ffce3941720 R14: 000000000000559e R15: 0000200000000240
 </TASK>

Showing all locks held in the system:
5 locks held by kworker/u8:2/37:
1 lock held by khungtaskd/39:
 #0: ffffffff8d3a9a40 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:331 [inline]
 #0: ffffffff8d3a9a40 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:841 [inline]
 #0: ffffffff8d3a9a40 (rcu_read_lock){....}-{1:3}, at: debug_show_all_locks+0x2e/0x180 kernel/locking/lockdep.c:6775
6 locks held by kworker/u8:11/3603:
2 locks held by kworker/u8:12/3615:
2 locks held by getty/5573:
 #0: ffff88823bf680a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref_wait+0x25/0x70 drivers/tty/tty_ldisc.c:243
 #1: ffffc90003e832e0 (&ldata->atomic_read_lock){+.+.}-{4:4}, at: n_tty_read+0x444/0x1400 drivers/tty/n_tty.c:2222
4 locks held by syz-execprog/5851:
2 locks held by udevd/6183:
5 locks held by udevd/6246:
1 lock held by syz.3.122/7794:
 #0: ffff888056e3a0d0 (&type->s_umount_key#53/1){+.+.}-{4:4}, at: alloc_super+0x204/0x990 fs/super.c:345
3 locks held by syz.1.325/10838:
2 locks held by syz.0.326/10840:
3 locks held by syz.5.327/10868:
1 lock held by syz.4.328/10869:
1 lock held by udevadm/10870:
1 lock held by udevadm/10871:

=============================================

NMI backtrace for cpu 0
CPU: 0 UID: 0 PID: 39 Comm: khungtaskd Not tainted syzkaller #0 PREEMPT_{RT,(full)} 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 nmi_cpu_backtrace+0x39e/0x3d0 lib/nmi_backtrace.c:113
 nmi_trigger_cpumask_backtrace+0x17a/0x300 lib/nmi_backtrace.c:62
 trigger_all_cpu_backtrace include/linux/nmi.h:160 [inline]
 check_hung_uninterruptible_tasks kernel/hung_task.c:328 [inline]
 watchdog+0xf93/0xfe0 kernel/hung_task.c:491
 kthread+0x711/0x8a0 kernel/kthread.c:463
 ret_from_fork+0x439/0x7d0 arch/x86/kernel/process.c:148
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>
Sending NMI from CPU 0 to CPUs 1:
NMI backtrace for cpu 1
CPU: 1 UID: 0 PID: 5961 Comm: syz-executor Not tainted syzkaller #0 PREEMPT_{RT,(full)} 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025
RIP: 0010:arch_static_branch arch/x86/include/asm/jump_label.h:36 [inline]
RIP: 0010:native_write_msr arch/x86/include/asm/msr.h:139 [inline]
RIP: 0010:wrmsrq arch/x86/include/asm/msr.h:199 [inline]
RIP: 0010:native_apic_msr_write+0x39/0x50 arch/x86/include/asm/apic.h:212
Code: 74 2a 83 ff 30 74 25 eb 10 81 ff d0 00 00 00 74 1b 81 ff e0 00 00 00 74 13 c1 ef 04 81 c7 00 08 00 00 89 f9 89 f0 31 d2 0f 30 <66> 90 c3 cc cc cc cc cc f3 0f 1e fa 89 f6 31 d2 e9 12 f0 3c 03 66
RSP: 0018:ffffc90004c97ae0 EFLAGS: 00000046
RAX: 000000000000ffa9 RBX: ffff8880b8923900 RCX: 0000000000000838
RDX: 0000000000000000 RSI: 000000000000ffa9 RDI: 0000000000000838
RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000100 R11: ffffffff816f9530 R12: 0000000010005fa1
R13: dffffc0000000000 R14: 000000000000ffa9 R15: 0000000000000020
FS:  0000555591360500(0000) GS:ffff888127122000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f8d49200000 CR3: 00000000203f6000 CR4: 00000000003526f0
Call Trace:
 <TASK>
 apic_write arch/x86/include/asm/apic.h:409 [inline]
 lapic_next_event+0x11/0x20 arch/x86/kernel/apic/apic.c:416
 clockevents_program_event+0x1cc/0x360 kernel/time/clockevents.c:334
 hrtimer_start_range_ns+0xdad/0x10a0 kernel/time/hrtimer.c:1323
 hrtimer_start_expires include/linux/hrtimer.h:273 [inline]
 hrtimer_sleeper_start_expires kernel/time/hrtimer.c:2039 [inline]
 do_nanosleep+0x1e1/0x650 kernel/time/hrtimer.c:2113
 hrtimer_nanosleep+0x1f7/0x410 kernel/time/hrtimer.c:2163
 __do_sys_clock_nanosleep kernel/time/posix-timers.c:1398 [inline]
 __se_sys_clock_nanosleep+0x2f1/0x380 kernel/time/posix-timers.c:1375
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fbf46231785
Code: 24 0c 89 3c 24 48 89 4c 24 18 e8 f6 54 ff ff 4c 8b 54 24 18 48 8b 54 24 10 41 89 c0 8b 74 24 0c 8b 3c 24 b8 e6 00 00 00 0f 05 <44> 89 c7 48 89 04 24 e8 4f 55 ff ff 48 8b 04 24 48 83 c4 28 f7 d8
RSP: 002b:00007fff91654ad0 EFLAGS: 00000293 ORIG_RAX: 00000000000000e6
RAX: ffffffffffffffda RBX: 0000000000000044 RCX: 00007fbf46231785
RDX: 00007fff91654b10 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 00007fff91654b7c R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000041
R13: 0000000000000050 R14: 0000000000078888 R15: 00007fff91654bd0
 </TASK>