Re: [PATCH 02/10] xfs: remove the i_mode check in xfs_release

Darrick J. Wong
2024-08-07T15:01:14Z

On Mon, Jun 24, 2024 at 05:50:11PM +0200, Christoph Hellwig wrote:
> On Mon, Jun 24, 2024 at 08:34:59AM -0700, Darrick J. Wong wrote:
> > > - if (!S_ISREG(VFS_I(ip)->i_mode) || (VFS_I(ip)->i_mode == 0))
> >
> > How would we encounter !i_mode regular files being released?
>
> We can't. If that code ever made any sense than in ancient pre-history
> in IRIX.
>
> > If an open file's link count is incorrectly low, it can't get freed
> > until after all the open file descriptors have been released, right?
> > Or is there some other vector for this?
>
> No.
>
> > I'm wondering if this ought to be:
> >
> > if (XFS_IS_CORRUPT(mp, !VFS_I(ip)->i_mode)) {
> > xfs_inode_mark_sick(ip);
> > return -EFSCORRUPTED;
> > }
>
> I wouldn't even bother with that.

Oh, right, because xfs_iget checks that for us and bails out before the
vfs can even get its hands on the file.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D