bcachefs (loop4): flagging btree freespace lost data
bcachefs (loop4): error reading btree root btree=freespace level=0: btree_node_read_error, fixing
BUG: sleeping function called from invalid context at ./include/linux/sched/mm.h:321
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 6483, name: syz.4.78
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
3 locks held by syz.4.78/6483:
#0: ffff88804f37c0e0 (&type->s_umount_key#64/1){+.+.}-{4:4}, at: alloc_super+0x221/0x9d0 fs/super.c:344
#1: ffff88806f584210 (&c->btree_trans_barrier){.+.+}-{0:0}, at: srcu_lock_acquire include/linux/srcu.h:161 [inline]
#1: ffff88806f584210 (&c->btree_trans_barrier){.+.+}-{0:0}, at: srcu_read_lock include/linux/srcu.h:253 [inline]
#1: ffff88806f584210 (&c->btree_trans_barrier){.+.+}-{0:0}, at: __bch2_trans_get+0x7ed/0xd40 fs/bcachefs/btree_iter.c:3386
#2: ffffffff8ed3dfe0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:331 [inline]
#2: ffffffff8ed3dfe0 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:841 [inline]
#2: ffffffff8ed3dfe0 (rcu_read_lock){....}-{1:3}, at: bch2_bkey_pick_read_device+0x29c/0x19b0 fs/bcachefs/extents.c:144
CPU: 0 UID: 0 PID: 6483 Comm: syz.4.78 Not tainted 6.14.0-syzkaller-12456-gacc4d5ff0b61 #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
__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:4102 [inline]
slab_alloc_node mm/slub.c:4180 [inline]
__do_kmalloc_node mm/slub.c:4330 [inline]
__kmalloc_node_track_caller_noprof+0xd3/0x4d0 mm/slub.c:4350
__do_krealloc mm/slub.c:4908 [inline]
krealloc_noprof+0x10f/0x300 mm/slub.c:4961
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_btree_node_read+0x7ac/0x29e0 fs/bcachefs/btree_io.c:1706
__bch2_btree_root_read fs/bcachefs/btree_io.c:1796 [inline]
bch2_btree_root_read+0x656/0x7e0 fs/bcachefs/btree_io.c:1818
read_btree_roots+0x3d7/0xa80 fs/bcachefs/recovery.c:581
bch2_fs_recovery+0x28e4/0x3e20 fs/bcachefs/recovery.c:928
bch2_fs_start+0x2fb/0x610 fs/bcachefs/super.c:1060
bch2_fs_get_tree+0x113e/0x18f0 fs/bcachefs/fs.c:2253
vfs_get_tree+0x90/0x2b0 fs/super.c:1759
do_new_mount+0x2cf/0xb70 fs/namespace.c:3878
do_mount fs/namespace.c:4218 [inline]
__do_sys_mount fs/namespace.c:4429 [inline]
__se_sys_mount+0x38c/0x400 fs/namespace.c:4406
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:0x7f93c798e90a
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:00007f93c8861e68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f93c8861ef0 RCX: 00007f93c798e90a
RDX: 0000200000000000 RSI: 0000200000000040 RDI: 00007f93c8861eb0
RBP: 0000200000000000 R08: 00007f93c8861ef0 R09: 0000000000000010
R10: 0000000000000010 R11: 0000000000000246 R12: 0000200000000040
R13: 00007f93c8861eb0 R14: 00000000000059b1 R15: 00002000000001c0
------------[ cut here ]------------
Voluntary context switch within RCU read-side critical section!
WARNING: CPU: 0 PID: 6483 at kernel/rcu/tree_plugin.h:332 rcu_note_context_switch+0x702/0x1060 kernel/rcu/tree_plugin.h:332
Modules linked in:
CPU: 0 UID: 0 PID: 6483 Comm: syz.4.78 Tainted: G W 6.14.0-syzkaller-12456-gacc4d5ff0b61 #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 24 1f 9f 0e 01 90 48 c7 c7 a0 ff 4b 8c e8 5f ff d8 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:ffffc900040de600 EFLAGS: 00010046
RAX: 354b030f418b7a00 RBX: ffff88802fbca244 RCX: 0000000000080000
RDX: ffffc9001030f000 RSI: 000000000007ffff RDI: 0000000000080000
RBP: ffffc900040de750 R08: ffffffff81826892 R09: 1ffffffff1d83354
R10: dffffc0000000000 R11: fffffbfff1d83355 R12: ffff888124fcf000
R13: dffffc0000000000 R14: ffff88802fbc9e00 R15: 0000000000000000
FS: 00007f93c88626c0(0000) GS:ffff888124fcf000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000556c68bfda18 CR3: 000000007b95c000 CR4: 00000000003526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
__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_btree_node_read+0x7ac/0x29e0 fs/bcachefs/btree_io.c:1706
__bch2_btree_root_read fs/bcachefs/btree_io.c:1796 [inline]
bch2_btree_root_read+0x656/0x7e0 fs/bcachefs/btree_io.c:1818
read_btree_roots+0x3d7/0xa80 fs/bcachefs/recovery.c:581
bch2_fs_recovery+0x28e4/0x3e20 fs/bcachefs/recovery.c:928
bch2_fs_start+0x2fb/0x610 fs/bcachefs/super.c:1060
bch2_fs_get_tree+0x113e/0x18f0 fs/bcachefs/fs.c:2253
vfs_get_tree+0x90/0x2b0 fs/super.c:1759
do_new_mount+0x2cf/0xb70 fs/namespace.c:3878
do_mount fs/namespace.c:4218 [inline]
__do_sys_mount fs/namespace.c:4429 [inline]
__se_sys_mount+0x38c/0x400 fs/namespace.c:4406
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:0x7f93c798e90a
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:00007f93c8861e68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f93c8861ef0 RCX: 00007f93c798e90a
RDX: 0000200000000000 RSI: 0000200000000040 RDI: 00007f93c8861eb0
RBP: 0000200000000000 R08: 00007f93c8861ef0 R09: 0000000000000010
R10: 0000000000000010 R11: 0000000000000246 R12: 0000200000000040
R13: 00007f93c8861eb0 R14: 00000000000059b1 R15: 00002000000001c0