From nobody Mon May 25 01:14:41 2026 Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.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 6183579CD for ; Wed, 20 May 2026 01:57:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779242278; cv=none; b=GYuOHtxnEqePq/86YRpU0hYCpZblZD1q2n8iNfalpSABBY6Yt1brrpqU4JaWl9Kb+vkZheio8Up/6D13bcT0u5yjmDmQ+PVtGM2KSavb+eBA597v0xoTluo7YKjcfAJFiZe8w43Pf06FcDGYEDS1GWK3oT5H9HZCtmPuhgT/ExY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779242278; c=relaxed/simple; bh=XBrMLPkvN9XMczzYBgcw9Kkjq4fZY+A3emCu7g+GQPg=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=JbpnteMBCfPRyVH1UiW4PRIZ7UrMYdeSrWxBa4979wkYT/ep4rQpt6TXs1L8LXGsDx/stPadsAMkaGjWgQXLNxDsMv0MCaJwkLUgtRi6RD2MwvjN7ZZD90wOAASwB54qGZSgy28zFuU0/0PKYxH/Mf5rV4l7wOzlUO/0ekvDQyE= 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.210.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-ot1-f72.google.com with SMTP id 46e09a7af769-7e3f58830cfso6360604a34.3 for ; Tue, 19 May 2026 18:57:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779242276; x=1779847076; 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=MSu9aTKuum5sPjWZJdg0+XPEKuAcRhMJ9GHZFPvhti0j7lT3Ds4xs5qFGouyi7Hcj9 zweeJ+GtUHtDK/TWLescE8Rc4yDAKbtMu23G/w3FAK7mAhL3MjmjcT1kTJnuTD4K6ys6 VSrCESBoVKEYTbD4lxBNjlfPhmm4JR2GLYyJP5LnqnFLhBTMJ6ZD1xY/TqqjRtT9XMrs Gn1zDaHb0SMOdcw5ipBmcuQuDEbrTgJ74mnBKHkSb8jKr1Z/teLptOtuYOfvlTto7toq NdC5I2gfQfRRfgo9iqVSPadYbuj5g/v0lZf1H1sRclLKTMudIvJhxcLSzvCpilmL2Cgx hQqg== X-Gm-Message-State: AOJu0YxEtI+jvlTmNEALzef2he6plO6tC09n0mxNmY16V41dzPhxxyn9 wVwU81mTaJC3Hl5VRrqiQBxppXN4i9DQvbnWOvwYv1xOuM1m1TL27Vzf1u8tzzh7SMBTPhzpVoR BETRyoFen128BFKh4Q4QOaaIC9xBmNysbs2C3fLOfped72MXQoU6+uTWiCng= 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:16a6:b0:69b:196a:de62 with SMTP id 006d021491bc7-69c94377590mr13460003eaf.27.1779242276262; Tue, 19 May 2026 18:57:56 -0700 (PDT) Date: Tue, 19 May 2026 18:57:56 -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: <6a0d1524.170a0220.3cbd30.013b.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