INFO: task syz.4.389:9571 blocked for more than 143 seconds.
      Not tainted syzkaller #0
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:syz.4.389       state:D stack:13944 pid:9571  tgid:9570  ppid:8943   task_flags:0x440140 flags:0x00004006
Call Trace:
 <TASK>
 __schedule+0x1798/0x4cc0
 schedule+0x165/0x360
 __closure_sync+0x163/0x220
 __bch2_write+0x31ef/0x3900
 bch2_writepages+0x211/0x2d0
 do_writepages+0x32e/0x550
 filemap_write_and_wait_range+0x21f/0x320
 bchfs_truncate+0x6a3/0xc20
 notify_change+0xb36/0xe40
 do_truncate+0x1a4/0x220
 vfs_truncate+0x493/0x520
 do_sys_truncate+0xdb/0x190
 __x64_sys_truncate+0x5b/0x70
 do_syscall_64+0xfa/0x3b0
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f4a56d8eba9
RSP: 002b:00007f4a57cac038 EFLAGS: 00000246 ORIG_RAX: 000000000000004c
RAX: ffffffffffffffda RBX: 00007f4a56fd5fa0 RCX: 00007f4a56d8eba9
RDX: 0000000000000000 RSI: 00000000000006e8 RDI: 0000200000000a80
RBP: 00007f4a56e11e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f4a56fd6038 R14: 00007f4a56fd5fa0 R15: 00007ffe155c1168
 </TASK>

Showing all locks held in the system:
1 lock held by khungtaskd/34:
 #0: ffffffff8e139f20 (rcu_read_lock){....}-{1:3}, at: debug_show_all_locks+0x2e/0x180
2 locks held by getty/5675:
 #0: ffff888022d190a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref_wait+0x25/0x70
 #1: ffffc900029032f0 (&ldata->atomic_read_lock){+.+.}-{4:4}, at: n_tty_read+0x43e/0x1400
2 locks held by syz.4.389/9571:
 #0: ffff888020bac428 (sb_writers#17){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90
 #1: ffff88803c8e9810 (&sb->s_type->i_mutex_key#24){++++}-{4:4}, at: do_truncate+0x171/0x220
2 locks held by syz.8.509/11268:
 #0: ffff888020bac0e0 (&type->s_umount_key#67){++++}-{4:4}, at: super_lock+0x2a9/0x3b0
 #1: ffff888020bac950 (&s->s_sync_lock){+.+.}-{4:4}, at: sync_inodes_sb+0x255/0xa10
4 locks held by syz.6.804/14026:
 #0: ffff888117040428 (sb_writers#17){.+.+}-{0:0}, at: direct_splice_actor+0x49/0x160
 #1: ffff888133604398 (&c->btree_trans_barrier){.+.+}-{0:0}, at: __bch2_trans_get+0x7f4/0xd80
 #2: ffff888133600920 (&c->sb_lock){+.+.}-{4:4}, at: bch2_mark_replicas_slowpath+0x233/0x580
 #3: ffff8881336049d8 (&c->mark_lock){++++}-{0:0}, at: bch2_mark_replicas_slowpath+0x3d6/0x580
1 lock held by syz.6.804/14058:
 #0: ffff88803e476c18 (&ima_iint_mutex_key[depth]){+.+.}-{4:4}, at: process_measurement+0x74b/0x1a40
2 locks held by syz.6.804/14063:
 #0: ffff888117040428 (sb_writers#17){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90
 #1: ffff88802a849fa8 (&sb->s_type->i_mutex_key#24){++++}-{4:4}, at: do_truncate+0x171/0x220
4 locks held by syz.3.806/14032:
2 locks held by syz.3.806/14053:
1 lock held by syz.3.806/14061:
 #0: ffff88810376d330 (&sb->s_type->i_mutex_key#20){++++}-{4:4}, at: process_measurement+0x3d8/0x1a40
3 locks held by bch-reclaim/loo/14048:
 #0: ffff88813364af68 (&j->reclaim_lock){+.+.}-{4:4}, at: bch2_journal_reclaim_thread+0x16b/0x4f0
 #1: ffff888133604398 (&c->btree_trans_barrier){.+.+}-{0:0}, at: __bch2_trans_get+0x7f4/0xd80
 #2: ffff8881205c01b0 (bcachefs_btree){+.+.}-{0:0}, at: __bch2_trans_get+0x7f4/0xd80

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

NMI backtrace for cpu 1
CPU: 1 UID: 0 PID: 34 Comm: khungtaskd Not tainted syzkaller #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: 14053 Comm: syz.3.806 Not tainted syzkaller #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:__sanitizer_cov_trace_pc+0x0/0x70
Code: 89 fb e8 23 00 00 00 48 8b 3d 14 76 fe 0b 48 89 de 5b e9 53 a0 58 00 cc cc cc 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 <f3> 0f 1e fa 48 8b 04 24 65 48 8b 0c 25 08 b0 a0 92 65 8b 15 38 01
RSP: 0018:ffffc9000449eb38 EFLAGS: 00000293
RAX: 0000000000000000 RBX: 0000000000000030 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc9000449ee78 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffffc9000449efd0
R13: ffff8881149f8b7c R14: 0000000000000000 R15: ffffc9000449efc8
FS:  00007eff829bd6c0(0000) GS:ffff8880b8615000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f2966e3d000 CR3: 000000012c372000 CR4: 00000000000006f0
Call Trace:
 <TASK>
 sha256_blocks_generic+0x8c3/0x1b70
 __sha256_update+0xf7/0x150
 crypto_sha256_update+0x27/0x40
 ima_calc_file_hash+0x8a0/0x16f0
 ima_collect_measurement+0x428/0x8e0
 process_measurement+0x1121/0x1a40
 ima_file_check+0xd7/0x120
 security_file_post_open+0xbb/0x290
 path_openat+0x2f26/0x3830
 do_filp_open+0x1fa/0x410
 do_sys_openat2+0x121/0x1c0
 __x64_sys_open+0x11e/0x150
 do_syscall_64+0xfa/0x3b0
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7eff81b8eba9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007eff829bd038 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 00007eff81dd6090 RCX: 00007eff81b8eba9
RDX: 0000000000000020 RSI: 000000000014927e RDI: 00002000000001c0
RBP: 00007eff81c11e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007eff81dd6128 R14: 00007eff81dd6090 R15: 00007ffc2b8a4cb8
 </TASK>
