WARNING in btrfs_chunk_alloc

Status: upstream: reported C repro on 2022/11/22 11:56
First crash: 7d00h, last: 2h06m

Cause bisection: the issue happens on the oldest tested release (bisect log)
Crash: WARNING in btrfs_create_pending_block_groups (log)
Repro: C syz .config

Sample crash report:
------------[ cut here ]------------
WARNING: CPU: 1 PID: 45 at fs/btrfs/block-group.c:3535 do_chunk_alloc fs/btrfs/block-group.c:3535 [inline]
WARNING: CPU: 1 PID: 45 at fs/btrfs/block-group.c:3535 btrfs_chunk_alloc.cold+0x1a7/0x329 fs/btrfs/block-group.c:3777
Modules linked in:
CPU: 1 PID: 45 Comm: kworker/u4:3 Not tainted 6.1.0-rc6-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Workqueue: events_unbound btrfs_async_reclaim_metadata_space
RIP: 0010:do_chunk_alloc fs/btrfs/block-group.c:3535 [inline]
RIP: 0010:btrfs_chunk_alloc.cold+0x1a7/0x329 fs/btrfs/block-group.c:3777
Code: 89 c7 89 c6 88 44 24 4f e8 5d 2e c7 f7 45 84 ff 0f 84 6e 01 00 00 e8 df 31 c7 f7 44 89 f6 48 c7 c7 c0 5c 98 8a e8 fb a4 f2 ff <0f> 0b e9 10 ff ff ff e8 c4 31 c7 f7 48 8b 54 24 38 b8 ff ff 37 00
RSP: 0018:ffffc90000d6fa70 EFLAGS: 00010286
RAX: 0000000000000000 RBX: 00000000ffffffe4 RCX: 0000000000000000
RDX: ffff888018452080 RSI: ffffffff8164973c RDI: fffff520001adf40
RBP: ffff88807bed9800 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000080000000 R11: 0000000000000000 R12: ffff888075d88898
R13: ffff888020971000 R14: ffffffffffffffe4 R15: 0000000075d88801
FS:  0000000000000000(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fa773a78250 CR3: 000000007d62e000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 flush_space+0x9ce/0xe90 fs/btrfs/space-info.c:769
 btrfs_async_reclaim_metadata_space+0x53f/0xc00 fs/btrfs/space-info.c:1083
 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289
 worker_thread+0x669/0x1090 kernel/workqueue.c:2436
 kthread+0x2e8/0x3a0 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

Crashes (6):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-selinux-root 2022/11/22 11:45 upstream eb7081409f94 1c576c23 .config log report syz C WARNING in btrfs_chunk_alloc
ci-upstream-kasan-gce-root 2022/11/26 14:49 upstream 0b1dcc2cf55a 74a66371 .config log report info WARNING in btrfs_chunk_alloc
ci-qemu-upstream 2022/11/26 04:50 upstream 0b1dcc2cf55a f4470a7b .config log report info WARNING in btrfs_chunk_alloc
ci-upstream-kasan-gce-root 2022/11/22 11:52 upstream eb7081409f94 1c576c23 .config log report info WARNING in btrfs_chunk_alloc
ci-upstream-kasan-gce-selinux-root 2022/11/22 11:30 upstream eb7081409f94 1c576c23 .config log report info WARNING in btrfs_chunk_alloc
ci-qemu-upstream-386 2022/11/29 09:54 upstream b7b275e60bcd ca9683b8 .config log report info WARNING in btrfs_chunk_alloc
* Struck through repros no longer work on HEAD.