Re: [PATCH 2/2] vfs: Fix anon_inode triggering VFS_BUG_ON_INODE in may_open()
From: Christian Brauner
Date: Fri Apr 04 2025 - 05:10:13 EST
On Fri, Apr 04, 2025 at 01:47:12AM -0700, Christoph Hellwig wrote:
> On Fri, Apr 04, 2025 at 10:45:43AM +0200, Christian Brauner wrote:
> > On Fri, Apr 04, 2025 at 01:31:58AM -0700, Christoph Hellwig wrote:
> > > Please make sure anon inodes have a valid mode set. Leaving this
> > > landmine around where we have inodes without a valid mode is just going
> > > to create more problems in the future.
> >
> > We've tried to change it, it immediately leads to userspace tools
> > regressions as they've started to rely on that behavior because it's been
> > like that since the dawn of time. We even had to work around that crap
> > in pidfs because lsof regressed. So now, we can't do this.
>
> Just because i_mode has something useful, we don't need to report that
> to userspace. We can still clear kstat.mode (with a big fat comment
> explaining why).
Yes, that's what we do in pidfs. I can do this for anon_inode as well.
>