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

Christoph Hellwig
2024-06-24T15:50:16Z

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.