Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: syzbot <syzbot+4bfcefc87d9600b7e26a@syzkaller.appspotmail.com>
To: dsterba@suse.com, linux-btrfs@vger.kernel.org,
	 linux-kernel@vger.kernel.org, mason@kernel.org,
	 syzkaller-bugs@googlegroups.com, wqu@suse.com
Subject: [syzbot] [btrfs?] WARNING in btrfs_destroy_inode (4)
Date: Tue, 01 Dec 2026 22:56:59 -0800	[thread overview]
Message-ID: <6b0fc13b.3ba11d86.1c9c77.002c.GAE@google.com> (raw)

Hello,

syzbot found the following issue on:

HEAD commit:    19cc08c1a6a6 Merge tag 'clk-fixes-for-linus-v7.4' of git:/..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1091b3bd580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=8979a1c07b42ca5b
dashboard link: https://syzkaller.appspot.com/bug?extid=4bfcefc87d9600b7e26a
compiler:       Debian clang version 22.1.8 (1~deb13u5), Debian LLD 22.1.8

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

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/98fce4d0b21b/non_bootable_disk-19cc08c1.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/d6a560403335/vmlinux-19cc08c1.xz
kernel image: https://storage.googleapis.com/syzbot-assets/8f99ab05faae/bzImage-19cc08c1.xz

The issue was bisected by AI to:

commit 13141df705b7145e46b88b1147d67d7a43f2d9e8
Author: Qu Wenruo <wqu@suse.com>
Date:   Mon Jul 28 08:27:56 2025 +0000

    btrfs: make nocow_one_range() to do cleanup on error

reasoning:      https://syzkaller.appspot.com/ai_job?id=0973296c-18fa-4f4a-9ead-93d0de40947e

AI-generated root cause summary:
In fs/btrfs/inode.c:nocow_one_range(), when writeback encounters an error (such
as btrfs_reloc_clone_csums() returning -EIO), the error path calls
btrfs_cleanup_ordered_extents() followed by extent_clear_unlock_delalloc().
Because btrfs_cleanup_ordered_extents() asynchronously queues ordered extent
completion to the endio worker pool and btrfs_finish_one_ordered() bypasses
extent range locking on BTRFS_ORDERED_IOERR, btrfs_remove_ordered_extent() can
execute before extent_clear_unlock_delalloc() clears the EXTENT_DELALLOC bit.
When this race occurs, btrfs_remove_ordered_extent() sees outstanding_extents >=
1, recalculates a non-zero reservation size, and releases only excess bytes;
subsequently, extent_clear_unlock_delalloc() clears EXTENT_DELALLOC without
passing EXTENT_CLEAR_META_RESV, decrementing outstanding_extents without
releasing the retained metadata reservation. When the inode is evicted and
destroyed, btrfs_destroy_inode() hits WARN_ON(inode->block_rsv.reserved) due to
the leaked reservation bytes.

full analysis:  https://syzkaller.appspot.com/x/ai_root_cause?x=4bfcefc87d9600b7e26a

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

The bisection result may be wrong.
If you agree with it, please also add:
Fixes: 13141df705b7 ("btrfs: make nocow_one_range() to do cleanup on error")

loop0: detected capacity change from 0 to 32768
BTRFS: device fsid 14d642db-7b15-43e4-81e6-4b8fac6a25f8 devid 1 transid 8 /dev/loop0 (7:0) scanned by syz.0.0 (5337)
BTRFS info (device loop0): first mount of filesystem 14d642db-7b15-43e4-81e6-4b8fac6a25f8
BTRFS info (device loop0): using blake2b checksum algorithm
BTRFS info (device loop0): enabling ssd optimizations
BTRFS info (device loop0): turning on async discard
BTRFS info (device loop0): enabling free space tree
BTRFS info (device loop0): use zstd compression, level 3
BTRFS info (device loop0): disk added /dev/nullb0
BTRFS info (device loop0): balance: start -dconvert=raid0 -mconvert=raid0
BTRFS info (device loop0): relocating block group 6881280 flags data|metadata
BTRFS info (device loop0): relocating block group 5242880 flags data|metadata
BTRFS error (device loop0 state A): Transaction 15 aborted (-EIO)
BTRFS: error (device loop0 state A) in __btrfs_update_delayed_inode:1027: errno=-5 IO failure
BTRFS info (device loop0 state EA): forced readonly
BTRFS: error (device loop0 state EA) in __btrfs_run_delayed_items:1160: errno=-5 IO failure
BTRFS warning (device loop0 state EA): Skipping commit of aborted transaction.
BTRFS: error (device loop0 state EA) in cleanup_transaction:2089: errno=-5 IO failure
BTRFS error (device loop0 state EA): nocow_one_range failed, root=-9 inode=258 start=53248 len=12288: -EIO
BTRFS error (device loop0 state EA): run_delalloc_nocow failed, root=18446744073709551607 inode=258 start=53248 len=12288 cur_offset=53248 oe_cleanup=53248 oe_cleanup_len=0 untouched_start=65536 untouched_len=0: -EIO
BTRFS error (device loop0 state EA): failed to run delalloc range, root=-9 ino=258 folio=53248 submit_bitmap=0 start=53248 len=12288: -EIO
------------[ cut here ]------------
inode->block_rsv.reserved
WARNING: fs/btrfs/inode.c:8096 at btrfs_destroy_inode+0x7a6/0x8c0 fs/btrfs/inode.c:8096, CPU#0: syz.0.0/5337
Modules linked in:
CPU: 0 UID: 0 PID: 5337 Comm: syz.0.0 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:btrfs_destroy_inode+0x7a6/0x8c0 fs/btrfs/inode.c:8096
Code: 46 fd ff e9 da fe ff ff e8 47 15 9b fd 90 0f 0b 90 e9 e7 f8 ff ff e8 39 15 9b fd 90 0f 0b 90 e9 11 f9 ff ff e8 2b 15 9b fd 90 <0f> 0b 90 e9 42 f9 ff ff e8 1d 15 9b fd 90 0f 0b 90 e9 66 f9 ff ff
RSP: 0018:ffffc9000e4af8c8 EFLAGS: 00010287
RAX: ffffffff842e4b85 RBX: 0000000000028000 RCX: 0000000000100000
RDX: ffffc9000ef02000 RSI: 000000000008704f RDI: 0000000000087050
RBP: ffff8880143231e0 R08: ffff88804236c7c7 R09: 1ffff1100846d8f8
R10: dffffc0000000000 R11: ffffffff842e43e0 R12: ffff888014323448
R13: 1ffff1100286463c R14: ffff888014323570 R15: dffffc0000000000
FS:  00007fce767d26c0(0000) GS:ffff88808a9e5000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000555ab4af6168 CR3: 0000000014b66000 CR4: 0000000000352ef0
Call Trace:
 <TASK>
 destroy_inode fs/inode.c:387 [inline]
 evict+0x99e/0xc20 fs/inode.c:853
 btrfs_relocate_block_group+0x7b2/0xaf0 fs/btrfs/relocation.c:5562
 btrfs_relocate_chunk+0x114/0x810 fs/btrfs/volumes.c:3768
 __btrfs_balance+0x1b5f/0x29d0 fs/btrfs/volumes.c:4707
 btrfs_balance+0xaa6/0x1180 fs/btrfs/volumes.c:5094
 btrfs_ioctl_balance+0x3da/0x640 fs/btrfs/ioctl.c:3518
 vfs_ioctl fs/ioctl.c:52 [inline]
 __do_sys_ioctl fs/ioctl.c:598 [inline]
 __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:584
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fce759a9b59
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fce767d1fe8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fce75c35fa0 RCX: 00007fce759a9b59
RDX: 0000200000011440 RSI: 00000000c4009420 RDI: 0000000000000005
RBP: 00007fce75a3a18b R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fce75c36038 R14: 00007fce75c35fa0 R15: 00007ffef2235c48
 </TASK>


---
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.
For information about bisection process see: https://goo.gl/tpsmEJ#ai-bisection

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

                 reply	other threads:[~2026-12-02  6:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b0fc13b.3ba11d86.1c9c77.002c.GAE@google.com \
    --to=syzbot+4bfcefc87d9600b7e26a@syzkaller.appspotmail.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mason@kernel.org \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox