[syzbot] [btrfs?] kernel BUG in btrfs_run_defrag_inodes

From: syzbot
Date: Thu Jun 29 2023 - 02:47:28 EST


Hello,

syzbot found the following issue on:

HEAD commit: a92b7d26c743 Merge tag 'drm-fixes-2023-06-23' of git://ano..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1446e8e0a80000
kernel config: https://syzkaller.appspot.com/x/.config?x=e74b395fe4978721
dashboard link: https://syzkaller.appspot.com/bug?extid=afec8fb60a29eee6de33
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/51be0f38ba27/disk-a92b7d26.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/b31a945d3cb5/vmlinux-a92b7d26.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f0b145c24307/bzImage-a92b7d26.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+afec8fb60a29eee6de33@xxxxxxxxxxxxxxxxxxxxxxxxx

------------[ cut here ]------------
kernel BUG at fs/inode.c:1763!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 5767 Comm: btrfs-cleaner Not tainted 6.4.0-rc7-syzkaller-00226-ga92b7d26c743 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
RIP: 0010:iput+0x8e8/0x8f0 fs/inode.c:1763
Code: e8 ff e9 b5 fb ff ff 44 89 e1 80 e1 07 80 c1 03 38 c1 0f 8c 46 fe ff ff 4c 89 e7 e8 c2 ec e8 ff e9 39 fe ff ff e8 c8 09 91 ff <0f> 0b 66 0f 1f 44 00 00 f3 0f 1e fa 55 41 57 41 56 53 48 89 f5 48
RSP: 0018:ffffc90015e37c70 EFLAGS: 00010293
RAX: ffffffff81fa7b28 RBX: 0000000000000040 RCX: ffff8880290cd940
RDX: 0000000000000000 RSI: 0000000000000040 RDI: 0000000000000000
RBP: ffff888075690448 R08: ffffffff81fa72a3 R09: fffffbfff1cabba6
R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000
R13: ffff8880214be130 R14: 0000000000000005 R15: ffff8880214be108
FS: 0000000000000000(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f4c3eb6dd50 CR3: 000000002cd46000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__btrfs_run_defrag_inode fs/btrfs/defrag.c:282 [inline]
btrfs_run_defrag_inodes+0xa90/0xe20 fs/btrfs/defrag.c:328
cleaner_kthread+0x287/0x3c0 fs/btrfs/disk-io.c:1739
kthread+0x2b8/0x350 kernel/kthread.c:379
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:iput+0x8e8/0x8f0 fs/inode.c:1763
Code: e8 ff e9 b5 fb ff ff 44 89 e1 80 e1 07 80 c1 03 38 c1 0f 8c 46 fe ff ff 4c 89 e7 e8 c2 ec e8 ff e9 39 fe ff ff e8 c8 09 91 ff <0f> 0b 66 0f 1f 44 00 00 f3 0f 1e fa 55 41 57 41 56 53 48 89 f5 48
RSP: 0018:ffffc90015e37c70 EFLAGS: 00010293
RAX: ffffffff81fa7b28 RBX: 0000000000000040 RCX: ffff8880290cd940
RDX: 0000000000000000 RSI: 0000000000000040 RDI: 0000000000000000
RBP: ffff888075690448 R08: ffffffff81fa72a3 R09: fffffbfff1cabba6
R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000
R13: ffff8880214be130 R14: 0000000000000005 R15: ffff8880214be108
FS: 0000000000000000(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000c02af7e000 CR3: 0000000036a4b000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400


---
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@xxxxxxxxxxxxxxxx.

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

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

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

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

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