Re: [PATCH v6 4/9] fs: have setattr_copy handle multigrain timestamps appropriately

Jan Kara
2024-07-17T11:24:12Z

On Mon 15-07-24 08:48:55, Jeff Layton wrote:
> The setattr codepath is still using coarse-grained timestamps, even on
> multigrain filesystems. To fix this, we need to fetch the timestamp for
> ctime updates later, at the point where the assignment occurs in
> setattr_copy.
>
> On a multigrain inode, ignore the ia_ctime in the attrs, and always
> update the ctime to the current clock value. Update the atime and mtime
> with the same value (if needed) unless they are being set to other
> specific values, a'la utimes().
>
> Note that we don't want to do this universally however, as some
> filesystems (e.g. most networked fs) want to do an explicit update
> elsewhere before updating the local inode.
>
> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
> Reviewed-by: Josef Bacik <josef@toxicpanda.com>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>

Looks good to me so feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

What is a bit bothering me is that it's now confusing that ATTR_MTIME_SET /
ATTR_ATIME_SET is handled in different place for mgtime and normal inodes
and I'm concerned this will bite us in the future. But not everybody is
using setattr_copy() and unifying the handling of timestamps seems like
quite some work...

Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR