Re: [syzbot] WARNING in kernfs_remove_by_name_ns (3)

From: Tejun Heo
Date: Wed May 15 2024 - 15:09:08 EST


On Wed, May 15, 2024 at 06:29:44PM +0200, David Sterba wrote:
> On Mon, Nov 08, 2021 at 03:24:26AM -0800, syzbot wrote:
> > Hello,
> >
> > syzbot found the following issue on:
> >
> > HEAD commit: ce840177930f Merge tag 'defconfig-5.16' of git://git.kerne..
> > git tree: upstream
> > console output: https://syzkaller.appspot.com/x/log.txt?x=1516eb12b00000
> > kernel config: https://syzkaller.appspot.com/x/.config?x=647adc5a101c9bf3
> > dashboard link: https://syzkaller.appspot.com/bug?extid=93cbdd0ab421adc5275d
> > compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> >
> > Unfortunately, I don't have any reproducer for this issue yet.
> >
> > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > Reported-by: syzbot+93cbdd0ab421adc5275d@xxxxxxxxxxxxxxxxxxxxxxxxx
> >
> > ------------[ cut here ]------------
> > kernfs: can not remove 'nr_tags', no directory
> > WARNING: CPU: 0 PID: 352 at fs/kernfs/dir.c:1535 kernfs_remove_by_name_ns+0x96/0xa0 fs/kernfs/dir.c:1535
>
> #syz set subsystems: kernfs
>
> Remove btrfs from subsystems. Multiple reports, injected ENOMEM and
> sysfs cannot remove the files and warns
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/kernfs/dir.c?id=d3fa86b1a7b4cdc4367acacea16b72e0a200b3d7#n1662

I can't tell what's happening just from the backtrace but it looks like
kobject_del() is being removed twice or removed without being added. The
kobj doesn't have kernfs_node attached but then tries to remove the files
which triggers the warning. Could be a bug in blk-mq. Can't immediately tell
from scanning the source tho. A repro would be really helpful.

Thanks.

--
tejun