From nobody Sun May 24 22:35:48 2026 Received: from mail-ot1-f69.google.com (mail-ot1-f69.google.com [209.85.210.69]) (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 46E43A95E for ; Thu, 21 May 2026 01:40:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.69 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779327641; cv=none; b=DVgi8cNh7YW6iqi7iHQtbBnXtw+D6cLxdGsW+gWPa+5mkzHc4SKegJ33piVS3bhcvbMT3d7R5azETmK6yaikokY2H+66bH5tVJjp2zMCrhtFrW5jvAucyia+GrEnmvU/iTFsNDrWNkitlD8kGSOddsWv8L8jPUiJxnt9HJpAfjw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779327641; c=relaxed/simple; bh=XBrMLPkvN9XMczzYBgcw9Kkjq4fZY+A3emCu7g+GQPg=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=b8yAr7wXJhOXKc10M++gcSCUcm3TwNX6RVhD4a6hAkxRqV/ljGs3KC17N3VSqol642TrR950EhuwQ7lcO17BSmzOb6AhCp1ryWzsKEnCZs0Lvp7ve8MbJoOl5TYc8y4MB1lQGP25d72CiWvC7vh9JVzKdpoT87LyvjN6kY6lfaA= 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.69 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-f69.google.com with SMTP id 46e09a7af769-7e4de59797fso12403073a34.3 for ; Wed, 20 May 2026 18:40:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779327635; x=1779932435; 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=sM2I6+pIGdLoMpq7OrKiWPixAet1rPhTFTJfA64AnkLYkz1XeeR+a0XY/p9X6Vn9FP gXsBmmyUYJScBW7Y5QKtPQ9+IkAK7hdDHRdTtzYs0iU7uH88ikyRtYSZV93j1zbv9mvE kCBrGY5iRPq7IuhK64Bf6ZYjggJiD0cK4hvoz3k/UDolrVtRTdPHLRsvP9jVqK9Se1I+ yPfIFyJ7E95BKwAF4JnAqpqU0tgaAZKYFKI4X2V2/Nnb32qnGp+0X+5SXiaPPWSXuAbc 7fYLMxYzMOsI/sR4APVDF4RPUbgL/UXNMNewroc3wKG26ME1ZzydT7L5GSW0vUp32P7l HNgA== X-Gm-Message-State: AOJu0Yw+qrEJVhWB/qVdpQJHF5avaNAuN+KFUWD7qPYAZm2zEIcljmsW ELxiX+WEY1+Cin5aa8QTII/3cpzu2ulejH7zH/XZBvwgRr+NXUKa3QdojOtLH4QI74n7ZnLW/9J oPiLqyGeyniMfa4Tcemeu2F0n9+j8sxweJKyNX7+dBfzfN5PcO70W5IMFpNM= 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:2205:b0:69b:3360:3f90 with SMTP id 006d021491bc7-69d6edf1cf3mr397654eaf.3.1779327635165; Wed, 20 May 2026 18:40:35 -0700 (PDT) Date: Wed, 20 May 2026 18:40:35 -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: <6a0e6293.a70a0220.c4b15.010b.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