Re: [PATCH v2 04/12] fat: only specify I_DIRTY_TIME when needed in fat_update_time()

Dave Chinner
2021-01-12T05:22:14Z

On Mon, Jan 11, 2021 at 11:50:27AM -0800, Eric Biggers wrote:
> On Mon, Jan 11, 2021 at 11:52:01AM +0100, Christoph Hellwig wrote:
> > On Fri, Jan 08, 2021 at 11:58:55PM -0800, Eric Biggers wrote:
> > > + if ((flags & S_VERSION) && inode_maybe_inc_iversion(inode, false))
> > > + dirty_flags |= I_DIRTY_SYNC;
> >
> > fat does not support i_version updates, so this bit can be skipped.
>
> Is that really the case? Any filesystem (including fat) can be mounted with
> "iversion", which causes SB_I_VERSION to be set.

That's a bug. Filesystems taht don't support persistent i_version on
disk need to clear SB_I_VERSION in their mount and remount paths
because the VFS iversion mount option was a complete screwup from
the start.

> A lot of filesystems (including fat) don't store i_version to disk, but it looks
> like it will still get updated in-memory. Could anything be relying on that?

If they do, then they are broken by definition. i_version as
reported to observers is defined as monotonically increasing with
every change to the inode. i.e. it never goes backwards. Which, of
course, it will do if you crash or even just unmount/mount a
filesystem that doesn't persist it.

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com