INFO: task bch-reclaim/loo:9755 blocked for more than 143 seconds.
      Not tainted 6.17.0-rc1-syzkaller-00036-gdfc0f6373094-dirty #0
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:bch-reclaim/loo state:D stack:22696 pid:9755  tgid:9755  ppid:2      task_flags:0x200040 flags:0x00004000
Call Trace:
 <TASK>
 __schedule+0x1798/0x4cc0
 schedule+0x165/0x360
 schedule_preempt_disabled+0x13/0x30
 __mutex_lock+0x7e6/0x1360
 bch2_journal_reclaim_thread+0x16b/0x4f0
 kthread+0x711/0x8a0
 ret_from_fork+0x3fc/0x770
 ret_from_fork_asm+0x1a/0x30
 </TASK>

Showing all locks held in the system:
5 locks held by kworker/0:0/9:
 #0: ffff888104ca5548 ((wq_completion)usb_hub_wq){+.+.}-{0:0}, at: process_scheduled_works+0x9b4/0x17b0
 #1: ffffc900000c7bc0 ((work_completion)(&hub->events)){+.+.}-{0:0}, at: process_scheduled_works+0x9ef/0x17b0
 #2: ffff88810a64a198 (&dev->mutex){....}-{4:4}, at: hub_event+0x184/0x4a20
 #3: ffff88810a64d518 (&port_dev->status_lock){+.+.}-{4:4}, at: hub_event+0x21b8/0x4a20
 #4: ffff888020000b68 (hcd->address0_mutex){+.+.}-{4:4}
, at: hub_event+0x21e5/0x4a20
1 lock held by khungtaskd/34:
 #0: ffffffff8e139ee0 (rcu_read_lock){....}-{1:3}, at: debug_show_all_locks+0x2e/0x180
2 locks held by getty/5674:
 #0: ffff88810de1d0a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref_wait+0x25/0x70
 #1: ffffc900029062f0 (&ldata->atomic_read_lock){+.+.}-{4:4}, at: n_tty_read+0x43e/0x1400
6 locks held by syz-executor/8729:
 #0: ffff88811e7960e0 (&type->s_umount_key#53){++++}-{4:4}, at: deactivate_super+0xa9/0xe0
 #1: ffff88803f480278 (&c->state_lock){++++}-{4:4}, at: __bch2_fs_stop+0xf8/0x900
 #2: ffff88803f4caf68 (&j->reclaim_lock){+.+.}-{4:4}, at: journal_flush_done+0x86/0x810
 #3: ffff88803f484398 (&c->btree_trans_barrier){.+.+}-{0:0}, at: __bch2_trans_get+0x7f4/0xd80
 #4: ffff88803f484740 (&wb->flushing.lock){+.+.}-{4:4}, at: btree_write_buffer_flush_seq+0x18bd/0x1a40
 #5: ffff88803f4a6710 (&c->gc_lock){++++}-{4:4}, at: bch2_btree_update_start+0x542/0x1de0
1 lock held by bch-reclaim/loo/9755:
 #0: ffff88803f4caf68 (&j->reclaim_lock){+.+.}-{4:4}, at: bch2_journal_reclaim_thread+0x16b/0x4f0
7 locks held by kworker/u9:6/10097:
 #0: ffff88803644a948 ((wq_completion)btree_update#2){+.+.}-{0:0}, at: process_scheduled_works+0x9b4/0x17b0
 #1: ffffc90002dcfbc0 ((work_completion)(&c->btree_interior_update_work)){+.+.}-{0:0}, at: process_scheduled_works+0x9ef/0x17b0
 #2: ffff88803db501b0 (bcachefs_btree){+.+.}-{0:0}, at: bch2_trans_begin+0xbe0/0x2310
 #3: ffff88802e704398 (&c->btree_trans_barrier){.+.+}-{0:0}, at: bch2_trans_srcu_lock+0xaf/0x220
 #4: ffff88802e74b148 (journal res){.+.+}-{0:0}, at: bch2_journal_res_get+0x6a9/0x8f0
 #5: ffff88802e7049d8 (&c->mark_lock){++++}-{0:0}, at: bch2_accounting_mem_insert+0x438/0xad0
 #6: ffffffff8e13f978 (rcu_state.exp_mutex){+.+.}-{4:4}, at: synchronize_rcu_expedited+0x2f6/0x730
1 lock held by syz.1.1432/12589:
1 lock held by syz.1.1432/12590:
2 locks held by syz.0.1433/12594:
 #0: ffff88802897c1b0 (bcachefs_btree){+.+.}-{0:0}, at: bch2_trans_begin+0x1030/0x2310
 #1: ffff88802e704398 (&c->btree_trans_barrier){.+.+}-{0:0}, at: bch2_trans_srcu_lock+0xaf/0x220
1 lock held by syz.3.1434/12607:

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

NMI backtrace for cpu 1
CPU: 1 UID: 0 PID: 34 Comm: khungtaskd Not tainted 6.17.0-rc1-syzkaller-00036-gdfc0f6373094-dirty #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250
 nmi_cpu_backtrace+0x39e/0x3d0
 nmi_trigger_cpumask_backtrace+0x17a/0x300
 watchdog+0xf93/0xfe0
 kthread+0x711/0x8a0
 ret_from_fork+0x3fc/0x770
 ret_from_fork_asm+0x1a/0x30
 </TASK>
Sending NMI from CPU 1 to CPUs 0:
NMI backtrace for cpu 0
CPU: 0 UID: 0 PID: 12594 Comm: syz.0.1433 Not tainted 6.17.0-rc1-syzkaller-00036-gdfc0f6373094-dirty #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
RIP: 0010:unwind_next_frame+0x179/0x2390
Code: 85 45 1b 00 00 f6 03 03 0f 85 e4 17 00 00 49 8d 5e 35 48 89 d8 48 c1 e8 03 48 89 44 24 28 0f b6 04 28 84 c0 0f 85 3c 1b 00 00 <4c> 89 6c 24 50 4c 89 64 24 20 4c 89 7c 24 48 48 89 5c 24 10 0f b6
RSP: 0018:ffffc90000007618 EFLAGS: 00000046
RAX: 0000000000000000 RBX: ffffc9000000777d RCX: 88b6744296824700
RDX: 0000000000000000 RSI: ffffffff8be333e0 RDI: ffffffff8be333a0
RBP: dffffc0000000000 R08: 0000000000000000 R09: ffffffff8172c195
R10: ffffc90000007748 R11: fffff52000000ef5 R12: 1ffff92000000ee9
R13: ffffc90000007798 R14: ffffc90000007748 R15: ffffffff8172c195
FS:  00007fe38d2516c0(0000) GS:ffff8880b861c000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fd912dff000 CR3: 000000010e654000 CR4: 00000000000006f0
Call Trace:
 <IRQ>
 __unwind_start+0x5b9/0x760
 arch_stack_walk+0xe4/0x150
 stack_trace_save+0x9c/0xe0
 kasan_save_stack+0x3e/0x60
 kasan_record_aux_stack+0xbd/0xd0
 insert_work+0x3d/0x330
 __queue_work+0xbaf/0xfb0
 call_timer_fn+0x17e/0x5f0
 __run_timer_base+0x646/0x860
 run_timer_softirq+0xb7/0x180
 handle_softirqs+0x286/0x870
 __irq_exit_rcu+0xca/0x1f0
 irq_exit_rcu+0x9/0x30
 sysvec_apic_timer_interrupt+0xa6/0xc0
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x1a/0x20
RIP: 0010:vprintk_emit+0x58f/0x7a0
Code: 85 32 01 00 00 e8 c1 86 1f 00 41 89 df 4d 85 f6 48 8b 1c 24 75 07 e8 b0 86 1f 00 eb 06 e8 a9 86 1f 00 fb 48 c7 c7 80 e1 12 8e <31> f6 ba 01 00 00 00 31 c9 41 b8 01 00 00 00 45 31 c9 53 e8 b9 35
RSP: 0018:ffffc9000466e540 EFLAGS: 00000246
RAX: ffffffff81a024e7 RBX: ffffffff81a023a4 RCX: 0000000000080000
RDX: ffffc900092cb000 RSI: 000000000007ffff RDI: ffffffff8e12e180
RBP: ffffc9000466e650 R08: ffffffff8fa37e37 R09: 1ffffffff1f46fc6
R10: dffffc0000000000 R11: fffffbfff1f46fc7 R12: dffffc0000000000
R13: 1ffff920008cdcac R14: 0000000000000200 R15: 0000000000000040
 _printk+0xcf/0x120
 bch2_print_string_as_lines+0x135/0x250
 __bch2_fsck_err+0xb99/0x1000
 __need_discard_or_freespace_err+0x13d/0x200
 bch2_check_alloc_key+0x1039/0x2a90
 bch2_check_alloc_info+0x157f/0x2b30
 __bch2_run_recovery_passes+0x3bd/0x1060
 bch2_run_recovery_passes+0x184/0x210
 bch2_fs_recovery+0x2690/0x3a50
 bch2_fs_start+0xaaf/0xda0
 bch2_fs_get_tree+0xb39/0x1520
 vfs_get_tree+0x92/0x2b0
 do_new_mount+0x2a2/0x9e0
 __se_sys_mount+0x317/0x410
 do_syscall_64+0xfa/0x3b0
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fe38c39038a
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 1a 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fe38d250e68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fe38d250ef0 RCX: 00007fe38c39038a
RDX: 0000200000000140 RSI: 00002000000000c0 RDI: 00007fe38d250eb0
RBP: 0000200000000140 R08: 00007fe38d250ef0 R09: 0000000000810002
R10: 0000000000810002 R11: 0000000000000246 R12: 00002000000000c0
R13: 00007fe38d250eb0 R14: 00000000000058fe R15: 0000200000000200
 </TASK>
