[syzbot] [bcachefs?] WARNING: suspicious RCU usage in bucket_gen

syzbot
2024-11-01T18:30:29Z

Hello,

syzbot found the following issue on:

HEAD commit: c1e939a21eb1 Merge tag 'cgroup-for-6.12-rc5-fixes' of git:..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10054630580000
kernel config: https://syzkaller.appspot.com/x/.config?x=4aec7739e14231a7
dashboard link: https://syzkaller.appspot.com/bug?extid=39b80f215d9825867301
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7feb34a89c2a/non_bootable_disk-c1e939a2.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/79a07b922222/vmlinux-c1e939a2.xz
kernel image: https://storage.googleapis.com/syzbot-assets/0a5d98e2bb0d/bzImage-c1e939a2.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+39b80f215d9825867301@syzkaller.appspotmail.com

=============================
WARNING: suspicious RCU usage
6.12.0-rc5-syzkaller-00044-gc1e939a21eb1 #0 Not tainted
-----------------------------
fs/bcachefs/buckets.h:94 suspicious rcu_dereference_check() usage!

other info that might help us debug this:

rcu_scheduler_active = 2, debug_locks = 1
4 locks held by kworker/u4:11/3443:
#0: ffff88801ac79148 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3204 [inline]
#0: ffff88801ac79148 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_scheduled_works+0x93b/0x1850 kernel/workqueue.c:3310
#1: ffffc9000e0ffd00 ((work_completion)(&rbio->work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3205 [inline]
#1: ffffc9000e0ffd00 ((work_completion)(&rbio->work)){+.+.}-{0:0}, at: process_scheduled_works+0x976/0x1850 kernel/workqueue.c:3310
#2: ffff88804fa84398 (&c->btree_trans_barrier){.+.+}-{0:0}, at: srcu_lock_acquire include/linux/srcu.h:151 [inline]
#2: ffff88804fa84398 (&c->btree_trans_barrier){.+.+}-{0:0}, at: srcu_read_lock include/linux/srcu.h:250 [inline]
#2: ffff88804fa84398 (&c->btree_trans_barrier){.+.+}-{0:0}, at: __bch2_trans_get+0x7de/0xd20 fs/bcachefs/btree_iter.c:3215
#3: ffff88804f35c128 (bcachefs_btree){+.+.}-{0:0}, at: trans_set_locked fs/bcachefs/btree_locking.h:194 [inline]
#3: ffff88804f35c128 (bcachefs_btree){+.+.}-{0:0}, at: bch2_trans_begin+0x9b0/0x1c00 fs/bcachefs/btree_iter.c:3112

stack backtrace:
CPU: 0 UID: 0 PID: 3443 Comm: kworker/u4:11 Not tainted 6.12.0-rc5-syzkaller-00044-gc1e939a21eb1 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Workqueue: events_unbound bch2_rbio_retry
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
lockdep_rcu_suspicious+0x226/0x340 kernel/locking/lockdep.c:6821
bucket_gens fs/bcachefs/buckets.h:90 [inline]
bucket_gen+0x200/0x220 fs/bcachefs/buckets.h:99
read_from_stale_dirty_pointer+0x513/0xca0 fs/bcachefs/io_read.c:805
__bch2_read_extent+0x994/0x4880 fs/bcachefs/io_read.c:896
__bch2_read+0x1094/0x1f70 fs/bcachefs/io_read.c:1212
bch2_rbio_retry+0x3bd/0x1340 fs/bcachefs/io_read.c:478
process_one_work kernel/workqueue.c:3229 [inline]
process_scheduled_works+0xa63/0x1850 kernel/workqueue.c:3310
worker_thread+0x870/0xd30 kernel/workqueue.c:3391
kthread+0x2f0/0x390 kernel/kthread.c:389
ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
</TASK>
bcachefs (loop0): Attempting to read from stale dirty pointer:
u64s 7 type extent 4099:8:U32_MAX len 8 ver 0: durability: 1 crc: c_size 8 size 8 offset 0 nonce 0 csum none 0:0 compress incompressible ptr: 0:34:0 gen 0 stale
memory gen: 1
u64s 13 type alloc_v4 0:34:0 len 0 ver 0:
gen 1 oldest_gen 0 data_type free
journal_seq 0
need_discard 0
need_inc_gen 0
dirty_sectors 0
stripe_sectors 0
cached_sectors 0
stripe 0
stripe_redundancy 0
io_time[READ] 1
io_time[WRITE] 1280
fragmentation 0
bp_start 8

bcachefs (loop0 inum 4099 offset 0): no device to read from: no_device_to_read_from
u64s 7 type extent 4099:8:U32_MAX len 8 ver 0: durability: 1 crc: c_size 8 size 8 offset 0 nonce 0 csum none 0:0 compress incompressible ptr: 0:34:0 gen 0 stale
bcachefs (loop0 inum 4099 offset 0): read error 3 from btree lookup
bcachefs (loop0): Attempting to read from stale dirty pointer:
u64s 7 type extent 4099:8:U32_MAX len 8 ver 0: durability: 1 crc: c_size 8 size 8 offset 0 nonce 0 csum none 0:0 compress incompressible ptr: 0:34:0 gen 0 stale
memory gen: 1
u64s 13 type alloc_v4 0:34:0 len 0 ver 0:
gen 1 oldest_gen 0 data_type free
journal_seq 0
need_discard 0
need_inc_gen 0
dirty_sectors 0
stripe_sectors 0
cached_sectors 0
stripe 0
stripe_redundancy 0
io_time[READ] 1
io_time[WRITE] 1280
fragmentation 0
bp_start 8

bcachefs (loop0 inum 4099 offset 0): no device to read from: no_device_to_read_from
u64s 7 type extent 4099:8:U32_MAX len 8 ver 0: durability: 1 crc: c_size 8 size 8 offset 0 nonce 0 csum none 0:0 compress incompressible ptr: 0:34:0 gen 0 stale
bcachefs (loop0 inum 4099 offset 0): read error 3 from btree lookup
bcachefs (loop0): Attempting to read from stale dirty pointer:
u64s 7 type extent 4099:8:U32_MAX len 8 ver 0: durability: 1 crc: c_size 8 size 8 offset 0 nonce 0 csum none 0:0 compress incompressible ptr: 0:34:0 gen 0 stale
memory gen: 1
u64s 13 type alloc_v4 0:34:0 len 0 ver 0:
gen 1 oldest_gen 0 data_type free
journal_seq 0
need_discard 0
need_inc_gen 0
dirty_sectors 0
stripe_sectors 0
cached_sectors 0
stripe 0
stripe_redundancy 0
io_time[READ] 1
io_time[WRITE] 1280
fragmentation 0
bp_start 8

bcachefs (loop0 inum 4099 offset 0): no device to read from: no_device_to_read_from
u64s 7 type extent 4099:8:U32_MAX len 8 ver 0: durability: 1 crc: c_size 8 size 8 offset 0 nonce 0 csum none 0:0 compress incompressible ptr: 0:34:0 gen 0 stale
bcachefs (loop0 inum 4099 offset 0): read error 3 from btree lookup

---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup