bcachefs (loop1): alloc_read... done bcachefs (loop1): snapshots_read... done bcachefs (loop1): Fixed errors, running fsck a second time to verify fs is clean bcachefs (loop1): done starting filesystem BUG: sleeping function called from invalid context at ./include/linux/sched/mm.h:321 in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 6176, name: syz.1.33 preempt_count: 0, expected: 0 RCU nest depth: 1, expected: 0 5 locks held by syz.1.33/6176: #0: ffff888011c818e8 (&ima_iint_mutex_key[depth]){+.+.}-{4:4}, at: process_measurement+0x7d6/0x1fe0 security/integrity/ima/ima_main.c:277 #1: ffff888059ada8e0 (mapping.invalidate_lock#9){.+.+}-{4:4}, at: filemap_invalidate_lock_shared include/linux/fs.h:922 [inline] #1: ffff888059ada8e0 (mapping.invalidate_lock#9){.+.+}-{4:4}, at: page_cache_ra_order+0x45e/0xca0 mm/readahead.c:491 #2: ffff88804ed04210 (&c->btree_trans_barrier){.+.+}-{0:0}, at: srcu_lock_acquire include/linux/srcu.h:161 [inline] #2: ffff88804ed04210 (&c->btree_trans_barrier){.+.+}-{0:0}, at: srcu_read_lock include/linux/srcu.h:253 [inline] #2: ffff88804ed04210 (&c->btree_trans_barrier){.+.+}-{0:0}, at: __bch2_trans_get+0x7ed/0xd40 fs/bcachefs/btree_iter.c:3386 #3: ffff88805b698140 (bcachefs_btree){+.+.}-{0:0}, at: trans_set_locked fs/bcachefs/btree_locking.h:198 [inline] #3: ffff88805b698140 (bcachefs_btree){+.+.}-{0:0}, at: __bch2_trans_relock+0x386/0x600 fs/bcachefs/btree_locking.c:786 #4: ffffffff8ed3b560 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:331 [inline] #4: ffffffff8ed3b560 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:841 [inline] #4: ffffffff8ed3b560 (rcu_read_lock){....}-{1:3}, at: bch2_bkey_pick_read_device+0x29c/0x19b0 fs/bcachefs/extents.c:144 CPU: 0 UID: 0 PID: 6176 Comm: syz.1.33 Not tainted 6.14.0-syzkaller-11270-g08733088b566 #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 __might_resched+0x558/0x6c0 kernel/sched/core.c:8818 might_alloc include/linux/sched/mm.h:321 [inline] slab_pre_alloc_hook mm/slub.c:4089 [inline] slab_alloc_node mm/slub.c:4167 [inline] __do_kmalloc_node mm/slub.c:4317 [inline] __kmalloc_node_track_caller_noprof+0xd3/0x4d0 mm/slub.c:4337 __do_krealloc mm/slub.c:4895 [inline] krealloc_noprof+0x10f/0x300 mm/slub.c:4948 bch2_printbuf_make_room+0x1f1/0x350 fs/bcachefs/printbuf.c:59 bch2_prt_printf+0x269/0x6d0 fs/bcachefs/printbuf.c:186 bch2_log_msg_start fs/bcachefs/error.c:19 [inline] bch2_fs_trans_inconsistent fs/bcachefs/error.c:63 [inline] bch2_fs_inconsistent+0x143/0x220 fs/bcachefs/error.c:81 bch2_dev_rcu fs/bcachefs/sb-members.h:226 [inline] bch2_bkey_pick_read_device+0x95e/0x19b0 fs/bcachefs/extents.c:165 __bch2_read_extent+0x3ab/0x4400 fs/bcachefs/io_read.c:963 bch2_read_extent fs/bcachefs/io_read.h:140 [inline] bchfs_read+0x251a/0x3350 fs/bcachefs/fs-io-buffered.c:226 bch2_readahead+0xe7a/0x12d0 fs/bcachefs/fs-io-buffered.c:301 read_pages+0x193/0x590 mm/readahead.c:160 page_cache_ra_order+0xa37/0xca0 mm/readahead.c:515 filemap_get_pages+0x59f/0x1fc0 mm/filemap.c:2602 filemap_read+0x466/0x1260 mm/filemap.c:2713 bch2_read_iter+0x1179/0x14b0 fs/bcachefs/fs-io-direct.c:221 __kernel_read+0x532/0xa10 fs/read_write.c:528 integrity_kernel_read+0xb2/0x100 security/integrity/iint.c:28 ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:480 [inline] ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline] ima_calc_file_hash+0xb22/0x1c10 security/integrity/ima/ima_crypto.c:568 ima_collect_measurement+0x52b/0xb20 security/integrity/ima/ima_api.c:293 process_measurement+0x13a3/0x1fe0 security/integrity/ima/ima_main.c:383 ima_file_check+0xdb/0x130 security/integrity/ima/ima_main.c:611 security_file_post_open+0xb9/0x280 security/security.c:3130 do_open fs/namei.c:3847 [inline] path_openat+0x2cf7/0x35d0 fs/namei.c:4004 do_filp_open+0x284/0x4e0 fs/namei.c:4031 do_sys_openat2+0x12b/0x1d0 fs/open.c:1429 do_sys_open fs/open.c:1444 [inline] __do_sys_openat fs/open.c:1460 [inline] __se_sys_openat fs/open.c:1455 [inline] __x64_sys_openat+0x249/0x2a0 fs/open.c:1455 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f0f6b38d169 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:00007f0f6c2c1038 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f0f6b5a5fa0 RCX: 00007f0f6b38d169 RDX: 0000000000143042 RSI: 0000200000000040 RDI: ffffffffffffff9c RBP: 00007f0f6b40e2a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f0f6b5a5fa0 R15: 00007ffe0dc1d798 </TASK> BUG: sleeping function called from invalid context at ./include/linux/sched/mm.h:321 in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 6176, name: syz.1.33 preempt_count: 0, expected: 0 RCU nest depth: 1, expected: 0 5 locks held by syz.1.33/6176: #0: ffff888011c818e8 (&ima_iint_mutex_key[depth]){+.+.}-{4:4}, at: process_measurement+0x7d6/0x1fe0 security/integrity/ima/ima_main.c:277 #1: ffff888059ada8e0 (mapping.invalidate_lock#9){.+.+}-{4:4}, at: filemap_invalidate_lock_shared include/linux/fs.h:922 [inline] #1: ffff888059ada8e0 (mapping.invalidate_lock#9){.+.+}-{4:4}, at: page_cache_ra_order+0x45e/0xca0 mm/readahead.c:491 #2: ffff88804ed04210 (&c->btree_trans_barrier){.+.+}-{0:0}, at: srcu_lock_acquire include/linux/srcu.h:161 [inline] #2: ffff88804ed04210 (&c->btree_trans_barrier){.+.+}-{0:0}, at: srcu_read_lock include/linux/srcu.h:253 [inline] #2: ffff88804ed04210 (&c->btree_trans_barrier){.+.+}-{0:0}, at: __bch2_trans_get+0x7ed/0xd40 fs/bcachefs/btree_iter.c:3386 #3: ffff88805b698140 (bcachefs_btree){+.+.}-{0:0}, at: trans_set_locked fs/bcachefs/btree_locking.h:198 [inline] #3: ffff88805b698140 (bcachefs_btree){+.+.}-{0:0}, at: __bch2_trans_relock+0x386/0x600 fs/bcachefs/btree_locking.c:786 #4: ffffffff8ed3b560 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:331 [inline] #4: ffffffff8ed3b560 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:841 [inline] #4: ffffffff8ed3b560 (rcu_read_lock){....}-{1:3}, at: bch2_bkey_pick_read_device+0x29c/0x19b0 fs/bcachefs/extents.c:144 CPU: 0 UID: 0 PID: 6176 Comm: syz.1.33 Tainted: G W 6.14.0-syzkaller-11270-g08733088b566 #0 PREEMPT(full) Tainted: [W]=WARN Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 __might_resched+0x558/0x6c0 kernel/sched/core.c:8818 might_alloc include/linux/sched/mm.h:321 [inline] slab_pre_alloc_hook mm/slub.c:4089 [inline] slab_alloc_node mm/slub.c:4167 [inline] __do_kmalloc_node mm/slub.c:4317 [inline] __kmalloc_node_track_caller_noprof+0xd3/0x4d0 mm/slub.c:4337 __do_krealloc mm/slub.c:4895 [inline] krealloc_noprof+0x10f/0x300 mm/slub.c:4948 bch2_printbuf_make_room+0x1f1/0x350 fs/bcachefs/printbuf.c:59 bch2_prt_vprintf+0x25f/0x6e0 fs/bcachefs/printbuf.c:169 bch2_fs_trans_inconsistent fs/bcachefs/error.c:65 [inline] bch2_fs_inconsistent+0x158/0x220 fs/bcachefs/error.c:81 bch2_dev_rcu fs/bcachefs/sb-members.h:226 [inline] bch2_bkey_pick_read_device+0x95e/0x19b0 fs/bcachefs/extents.c:165 __bch2_read_extent+0x3ab/0x4400 fs/bcachefs/io_read.c:963 bch2_read_extent fs/bcachefs/io_read.h:140 [inline] bchfs_read+0x251a/0x3350 fs/bcachefs/fs-io-buffered.c:226 bch2_readahead+0xe7a/0x12d0 fs/bcachefs/fs-io-buffered.c:301 read_pages+0x193/0x590 mm/readahead.c:160 page_cache_ra_order+0xa37/0xca0 mm/readahead.c:515 filemap_get_pages+0x59f/0x1fc0 mm/filemap.c:2602 filemap_read+0x466/0x1260 mm/filemap.c:2713 bch2_read_iter+0x1179/0x14b0 fs/bcachefs/fs-io-direct.c:221 __kernel_read+0x532/0xa10 fs/read_write.c:528 integrity_kernel_read+0xb2/0x100 security/integrity/iint.c:28 ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:480 [inline] ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline] ima_calc_file_hash+0xb22/0x1c10 security/integrity/ima/ima_crypto.c:568 ima_collect_measurement+0x52b/0xb20 security/integrity/ima/ima_api.c:293 process_measurement+0x13a3/0x1fe0 security/integrity/ima/ima_main.c:383 ima_file_check+0xdb/0x130 security/integrity/ima/ima_main.c:611 security_file_post_open+0xb9/0x280 security/security.c:3130 do_open fs/namei.c:3847 [inline] path_openat+0x2cf7/0x35d0 fs/namei.c:4004 do_filp_open+0x284/0x4e0 fs/namei.c:4031 do_sys_openat2+0x12b/0x1d0 fs/open.c:1429 do_sys_open fs/open.c:1444 [inline] __do_sys_openat fs/open.c:1460 [inline] __se_sys_openat fs/open.c:1455 [inline] __x64_sys_openat+0x249/0x2a0 fs/open.c:1455 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f0f6b38d169 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:00007f0f6c2c1038 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f0f6b5a5fa0 RCX: 00007f0f6b38d169 RDX: 0000000000143042 RSI: 0000200000000040 RDI: ffffffffffffff9c RBP: 00007f0f6b40e2a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f0f6b5a5fa0 R15: 00007ffe0dc1d798 </TASK> bcachefs (loop1): pointer to nonexistent device 237 bcachefs (loop1): /file3 offset 0: no_devices_valid u64s 7 type extent 536870913:24:U32_MAX len 24 ver 0: durability: 0 crc: c_size 8 size 24 offset 0 nonce 0 csum none 0:0 compress lz4 ptr: 237:893353206280 gen 0 ------------[ cut here ]------------ Voluntary context switch within RCU read-side critical section! WARNING: CPU: 1 PID: 6176 at kernel/rcu/tree_plugin.h:332 rcu_note_context_switch+0x702/0x1060 kernel/rcu/tree_plugin.h:332 Modules linked in: CPU: 1 UID: 0 PID: 6176 Comm: syz.1.33 Tainted: G W 6.14.0-syzkaller-11270-g08733088b566 #0 PREEMPT(full) Tainted: [W]=WARN Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 RIP: 0010:rcu_note_context_switch+0x702/0x1060 kernel/rcu/tree_plugin.h:332 Code: 00 e9 cc 00 00 00 41 83 fd 06 0f 84 92 00 00 00 e9 bd 00 00 00 c6 05 f9 ce 9e 0e 01 90 48 c7 c7 00 ff 4b 8c e8 6f 05 d9 ff 90 <0f> 0b 90 90 e9 36 fa ff ff 90 0f 0b 90 45 84 ff 0f 84 fc f9 ff ff RSP: 0018:ffffc900044dce40 EFLAGS: 00010046 RAX: 46f5c87a8f861800 RBX: ffff88802563c044 RCX: 0000000000080000 RDX: ffffc90004a72000 RSI: 000000000007ffff RDI: 0000000000080000 RBP: ffffc900044dcf90 R08: ffffffff81827732 R09: 1ffffffff1d82e00 R10: dffffc0000000000 R11: fffffbfff1d82e01 R12: ffff8881250e2000 R13: dffffc0000000000 R14: ffff88802563bc00 R15: 0000000000000000 FS: 00007f0f6c2c16c0(0000) GS:ffff8881250e2000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffc20b1bc48 CR3: 0000000034386000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> __schedule+0x3b3/0x51f0 kernel/sched/core.c:6672 __schedule_loop kernel/sched/core.c:6845 [inline] schedule+0x163/0x360 kernel/sched/core.c:6860 schedule_timeout+0xb1/0x2b0 kernel/time/sleep_timeout.c:75 ___down_common kernel/locking/semaphore.c:229 [inline] __down_common+0x373/0x830 kernel/locking/semaphore.c:250 down+0x84/0xc0 kernel/locking/semaphore.c:64 console_lock+0x145/0x1b0 kernel/printk/printk.c:2849 __bch2_print_string_as_lines fs/bcachefs/util.c:267 [inline] bch2_print_string_as_lines+0x2d/0x140 fs/bcachefs/util.c:286 bch2_fs_trans_inconsistent fs/bcachefs/error.c:71 [inline] bch2_fs_inconsistent+0x195/0x220 fs/bcachefs/error.c:81 bch2_dev_rcu fs/bcachefs/sb-members.h:226 [inline] bch2_bkey_pick_read_device+0x95e/0x19b0 fs/bcachefs/extents.c:165 __bch2_read_extent+0x3ab/0x4400 fs/bcachefs/io_read.c:963 bch2_read_extent fs/bcachefs/io_read.h:140 [inline] bchfs_read+0x251a/0x3350 fs/bcachefs/fs-io-buffered.c:226 bch2_read_single_folio+0x634/0x8a0 fs/bcachefs/fs-io-buffered.c:345 bch2_read_folio+0x3a/0x70 fs/bcachefs/fs-io-buffered.c:363 filemap_read_folio+0x14a/0x3b0 mm/filemap.c:2412 filemap_update_page mm/filemap.c:2496 [inline] filemap_get_pages+0x179e/0x1fc0 mm/filemap.c:2624 filemap_read+0x466/0x1260 mm/filemap.c:2713 bch2_read_iter+0x1179/0x14b0 fs/bcachefs/fs-io-direct.c:221 __kernel_read+0x532/0xa10 fs/read_write.c:528 integrity_kernel_read+0xb2/0x100 security/integrity/iint.c:28 ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:480 [inline] ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline] ima_calc_file_hash+0xb22/0x1c10 security/integrity/ima/ima_crypto.c:568 ima_collect_measurement+0x52b/0xb20 security/integrity/ima/ima_api.c:293 process_measurement+0x13a3/0x1fe0 security/integrity/ima/ima_main.c:383 ima_file_check+0xdb/0x130 security/integrity/ima/ima_main.c:611 security_file_post_open+0xb9/0x280 security/security.c:3130 do_open fs/namei.c:3847 [inline] path_openat+0x2cf7/0x35d0 fs/namei.c:4004 do_filp_open+0x284/0x4e0 fs/namei.c:4031 do_sys_openat2+0x12b/0x1d0 fs/open.c:1429 do_sys_open fs/open.c:1444 [inline] __do_sys_openat fs/open.c:1460 [inline] __se_sys_openat fs/open.c:1455 [inline] __x64_sys_openat+0x249/0x2a0 fs/open.c:1455 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f0f6b38d169 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:00007f0f6c2c1038 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f0f6b5a5fa0 RCX: 00007f0f6b38d169 RDX: 0000000000143042 RSI: 0000200000000040 RDI: ffffffffffffff9c RBP: 00007f0f6b40e2a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f0f6b5a5fa0 R15: 00007ffe0dc1d798 </TASK>