[syzbot] [btrfs?] WARNING in btrfs_rename2 (2)

1 view
Skip to first unread message

syzbot

unread,
4:54 PM (6 hours ago) 4:54 PM
to c...@fb.com, dst...@suse.com, linux...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: d458a240344c Merge tag 'block-7.1-20260515' of git://git.k..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12de58ec580000
kernel config: https://syzkaller.appspot.com/x/.config?x=f2e8ebfec4636d32
dashboard link: https://syzkaller.appspot.com/bug?extid=8b14244ee8d43b313915
compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=142e1fce580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=146998c8580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/81db812cf8a9/disk-d458a240.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/d60234f33956/vmlinux-d458a240.xz
kernel image: https://storage.googleapis.com/syzbot-assets/06b47f22d6a0/bzImage-d458a240.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/37b66df1a3ba/mount_0.gz
fsck result: OK (log: https://syzkaller.appspot.com/x/fsck.log?x=15804d6a580000)

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

------------[ cut here ]------------
!new_inode
WARNING: fs/btrfs/inode.c:8616 at btrfs_rename fs/btrfs/inode.c:8616 [inline], CPU#1: syz.1.22/6085
WARNING: fs/btrfs/inode.c:8616 at btrfs_rename2+0x1c07/0x40d0 fs/btrfs/inode.c:8854, CPU#1: syz.1.22/6085
Modules linked in:
CPU: 1 UID: 0 PID: 6085 Comm: syz.1.22 Not tainted syzkaller #0 PREEMPT_{RT,(full)}
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/18/2026
RIP: 0010:btrfs_rename fs/btrfs/inode.c:8616 [inline]
RIP: 0010:btrfs_rename2+0x1c07/0x40d0 fs/btrfs/inode.c:8854
Code: 00 e8 4d 43 dc fd 41 80 f6 01 45 0f b6 c6 48 8b 7c 24 18 48 c7 c6 46 09 67 8d ba 3b 21 00 00 e9 53 03 00 00 e8 2a 43 dc fd 90 <0f> 0b 90 41 bf ef ff ff ff e9 f2 f9 ff ff 4c 89 7c 24 08 4c 8b 7c
RSP: 0018:ffffc900046cf800 EFLAGS: 00010293
RAX: ffffffff83e83636 RBX: fffff520008d9f24 RCX: ffff888029319ec0
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc900046cfbb0 R08: ffff888029319ec0 R09: 0000000000000002
R10: 0000000000000100 R11: 00000000ffffffef R12: ffffc900046cfa38
R13: 1ffff1100bdaf993 R14: 00000000ffffffef R15: ffff8880457d4c58
FS: 00007f08aa1556c0(0000) GS:ffff888126274000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f6dee4c5000 CR3: 000000003d816000 CR4: 00000000003526f0
Call Trace:
<TASK>
vfs_rename+0xa96/0xeb0 fs/namei.c:6054
filename_renameat2+0x539/0x9c0 fs/namei.c:6172
__do_sys_rename fs/namei.c:6216 [inline]
__se_sys_rename+0x55/0x2c0 fs/namei.c:6212
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x15f/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f08aab1ce59
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:00007f08aa155028 EFLAGS: 00000246 ORIG_RAX: 0000000000000052
RAX: ffffffffffffffda RBX: 00007f08aad96090 RCX: 00007f08aab1ce59
RDX: 0000000000000000 RSI: 00002000000002c0 RDI: 0000200000000280
RBP: 00007f08aabb2d6f R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f08aad96128 R14: 00007f08aad96090 R15: 00007ffc34538de8
</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 syzk...@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 syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

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

syzbot

unread,
8:31 PM (2 hours ago) 8:31 PM
to linux-...@vger.kernel.org, syzkall...@googlegroups.com
For archival purposes, forwarding an incoming command email to
linux-...@vger.kernel.org, syzkall...@googlegroups.com.

***

Subject: [PATCH] btrfs: add debug printks to trace lookup vs rename collision mismatch
Author: karti...@gmail.com

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master


Add printk statements in btrfs_lookup_dentry(), btrfs_lookup(), and
btrfs_rename() to investigate why the WARN_ON(!new_inode) in
btrfs_rename() fires.

Hypothesis: the VFS dentry view (negative) disagrees with the on-disk
dir_item view (present) because btrfs_inode_by_name() finds the
dir_item but btrfs_iget() fails to load the target inode, causing
btrfs_lookup() to return a negative dentry while
btrfs_check_dir_item_collision() still sees the dir_item.

Not for upstream.

Reported-by: syzbot+8b1424...@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=8b14244ee8d43b313915
Signed-off-by: Deepanshu Kartikey <karti...@gmail.com>
---
fs/btrfs/inode.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 75136a172710..c8dbfd6fe76d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6073,11 +6073,19 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
return ERR_PTR(-ENAMETOOLONG);

ret = btrfs_inode_by_name(BTRFS_I(dir), dentry, &location, &di_type);
+ printk(KERN_INFO "BTRFS_DBG lookup_dentry: name='%.*s' inode_by_name ret=%d loc.type=%u loc.objectid=%llu\n",
+ (int)dentry->d_name.len, dentry->d_name.name,
+ ret, location.type, location.objectid);
if (ret < 0)
return ERR_PTR(ret);

if (location.type == BTRFS_INODE_ITEM_KEY) {
+ printk(KERN_INFO "BTRFS_DBG lookup_dentry: calling iget objectid=%llu\n",
+ location.objectid);
inode = btrfs_iget(location.objectid, root);
+ printk(KERN_INFO "BTRFS_DBG lookup_dentry: iget returned %s (err=%ld)\n",
+ IS_ERR(inode) ? "ERR" : "OK",
+ IS_ERR(inode) ? PTR_ERR(inode) : 0);
if (IS_ERR(inode))
return ERR_CAST(inode);

@@ -6147,6 +6155,10 @@ static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry,
{
struct inode *inode = btrfs_lookup_dentry(dir, dentry);

+ printk(KERN_INFO "BTRFS_DBG lookup: name='%.*s' lookup_dentry returned %s (err=%ld)\n",
+ (int)dentry->d_name.len, dentry->d_name.name,
+ IS_ERR(inode) ? "ERR" : (inode ? "INODE" : "NULL"),
+ IS_ERR(inode) ? PTR_ERR(inode) : 0);
if (inode == ERR_PTR(-ENOENT))
inode = NULL;
return d_splice_alias(inode, dentry);
@@ -8609,6 +8621,9 @@ static int btrfs_rename(struct mnt_idmap *idmap,

/* check for collisions, even if the name isn't there */
ret = btrfs_check_dir_item_collision(dest, new_dir->i_ino, &new_fname.disk_name);
+ printk(KERN_INFO "BTRFS_DBG btrfs_rename: collision check ret=%d new_inode=%p new_dentry='%.*s'\n",
+ ret, new_inode,
+ (int)new_dentry->d_name.len, new_dentry->d_name.name);
if (ret) {
if (ret == -EEXIST) {
/* we shouldn't get
--
2.43.0

syzbot

unread,
9:06 PM (1 hour ago) 9:06 PM
to karti...@gmail.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
lost connection to test machine



Tested on:

commit: 27fa8262 Merge tag 'ata-7.1-rc5' of git://git.kernel.o..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1120c42e580000
kernel config: https://syzkaller.appspot.com/x/.config?x=f2e8ebfec4636d32
dashboard link: https://syzkaller.appspot.com/bug?extid=8b14244ee8d43b313915
compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
patch: https://syzkaller.appspot.com/x/patch.diff?x=151e02c8580000

syzbot

unread,
9:57 PM (28 minutes ago) 9:57 PM
to linux-...@vger.kernel.org, syzkall...@googlegroups.com

syzbot

unread,
10:22 PM (3 minutes ago) 10:22 PM
to karti...@gmail.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
lost connection to test machine



Tested on:

commit: 27fa8262 Merge tag 'ata-7.1-rc5' of git://git.kernel.o..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=17d8c42e580000
kernel config: https://syzkaller.appspot.com/x/.config?x=f2e8ebfec4636d32
dashboard link: https://syzkaller.appspot.com/bug?extid=8b14244ee8d43b313915
compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
patch: https://syzkaller.appspot.com/x/patch.diff?x=1739d8c8580000

Reply all
Reply to author
Forward
0 new messages