From nobody Mon May 25 01:15:10 2026 Received: from mail-oa1-f72.google.com (mail-oa1-f72.google.com [209.85.160.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF960343899 for ; Wed, 20 May 2026 00:31:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779237063; cv=none; b=a68U0+2tHtF49SkH3NBReJZYFRGyZiYAy2IpMASGsr378SHco1UVAyQvXCRED1WrKmNLqtiMcCfNtKe+pRKbLHoHr859ykoLbTaz4hEycvqgzQqB1CXxLw0h0xXqLb00p2a87fkPCR8pUaqXySZdtE1rD9yWePmLBXFFq+L3gzw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779237063; c=relaxed/simple; bh=XBrMLPkvN9XMczzYBgcw9Kkjq4fZY+A3emCu7g+GQPg=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=u27ZZtfOIHK6EHCi5Dkr5SLqLdmKtwZDhgxZ0BaSCnU/up+S1oW7gSda1MhJv0LfuXblzOUP9WrqqiToZULERi62+Yzfg7GLRSPXS3e604IO1H6GhiiHHuKfU5SoaMNnIuosr+i82er/UevSFzWzqCtje3HK11ZfW+gEEeTx+mQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.160.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oa1-f72.google.com with SMTP id 586e51a60fabf-43a450334c8so10961343fac.3 for ; Tue, 19 May 2026 17:31:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779237060; x=1779841860; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sYhTU2CQtjjdHvvKK4VtlQitwKWzcI5XrNydUbLkU2Q=; b=r1XuSZxLwKrDqcp1JlMMm1wn9cjpcJV+zB/p3+uhR3KqHsFiPq/HE9S6idhxBJ5Sjh cJr3llLwkrnulkQxByUv3FgA/KR5NbVmChnFOQFA/2FaH6CzA4yi256lT3784b+kVUJk +UfBrotzokbCS0aVmwwCLSBXuhFC1vW+5eyBShG/iTiV6SJhJtHmjNA2LoOJnVZBxYd0 qy9RX6MyW2h/1ozoPLwD3cFQK4/qyYQG48/GaEUmVH27HDy5jD3Xj/NEon4KZW9zl1kv Mgc1u9L3UnmQXn/HtpR20FKe+58mnVylIDHpUy9hkbgEkPxiD+pKLI+Oj3GdLp5xtBVa CK1Q== X-Gm-Message-State: AOJu0Ywct4thWgBAwZiw92bA8iU/Sl6xHmRIDGjhVYEGCbgPT4UvGIjk j20ZXE5oEgaBqagbbFs1h9vgSu+fbH4ey+3/TMiZAKwjlGKYU2QKMnXveu9Hup+Nn+181vRyfLm dDfJs7wyHUMiTwvzr6/xHFn3Na1GvoFvH4t6MzFXvsI8adU8b94oAMRPu2yQ= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:1688:b0:694:9ea7:7aa1 with SMTP id 006d021491bc7-69c942ae161mr14128454eaf.5.1779237060594; Tue, 19 May 2026 17:31:00 -0700 (PDT) Date: Tue, 19 May 2026 17:31:00 -0700 In-Reply-To: <6a0cce0d.170a0220.3cbd30.0137.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6a0d00c4.170a0220.3cbd30.0139.GAE@google.com> Subject: Forwarded: [PATCH] btrfs: add debug printks to trace lookup vs rename collision mismatch From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] btrfs: add debug printks to trace lookup vs rename collisi= on mismatch Author: kartikey406@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+8b14244ee8d43b313915@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D8b14244ee8d43b313915 Signed-off-by: Deepanshu Kartikey --- 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); =20 ret =3D btrfs_inode_by_name(BTRFS_I(dir), dentry, &location, &di_type); + printk(KERN_INFO "BTRFS_DBG lookup_dentry: name=3D'%.*s' inode_by_name re= t=3D%d loc.type=3D%u loc.objectid=3D%llu\n", + (int)dentry->d_name.len, dentry->d_name.name, + ret, location.type, location.objectid); if (ret < 0) return ERR_PTR(ret); =20 if (location.type =3D=3D BTRFS_INODE_ITEM_KEY) { + printk(KERN_INFO "BTRFS_DBG lookup_dentry: calling iget objectid=3D%llu\= n", + location.objectid); inode =3D btrfs_iget(location.objectid, root); + printk(KERN_INFO "BTRFS_DBG lookup_dentry: iget returned %s (err=3D%ld)= \n", + IS_ERR(inode) ? "ERR" : "OK", + IS_ERR(inode) ? PTR_ERR(inode) : 0); if (IS_ERR(inode)) return ERR_CAST(inode); =20 @@ -6147,6 +6155,10 @@ static struct dentry *btrfs_lookup(struct inode *dir= , struct dentry *dentry, { struct inode *inode =3D btrfs_lookup_dentry(dir, dentry); =20 + printk(KERN_INFO "BTRFS_DBG lookup: name=3D'%.*s' lookup_dentry returned = %s (err=3D%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 =3D=3D ERR_PTR(-ENOENT)) inode =3D NULL; return d_splice_alias(inode, dentry); @@ -8609,6 +8621,9 @@ static int btrfs_rename(struct mnt_idmap *idmap, =20 /* check for collisions, even if the name isn't there */ ret =3D btrfs_check_dir_item_collision(dest, new_dir->i_ino, &new_fname.d= isk_name); + printk(KERN_INFO "BTRFS_DBG btrfs_rename: collision check ret=3D%d new_i= node=3D%p new_dentry=3D'%.*s'\n", + ret, new_inode, + (int)new_dentry->d_name.len, new_dentry->d_name.name); if (ret) { if (ret =3D=3D -EEXIST) { /* we shouldn't get --=20 2.43.0