Re: RFC: atime and ZFS snapshots

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Tue, 24 Mar 2026 23:50:09 UTC
On Tue, Mar 24, 2026 at 04:20:20PM -0700, Rick Macklem wrote:
> Hi,
> 
> Commit cc760de and 57ce37f (in main) modified the
> NFSv4.2 behaviour to attempt to always make the
> atime get updated for the <from> file for copy_file_range(2).
> (At the time, the concensus seemed to be that this was
> correct behaviour.)
> 
> This was done via a Setattr of atime unless "noatime"
> is specified on the mount.
> 
> But, for a file in a ZFS snapshot, the atime never gets
> updated (not surprising) and, as such, EROFS gets
> replied unless "noatime" is specified for an NFSv4.2
> mount.
> 
> Does this sound correct or should the NFSv4.2 server
> ignore the EROFS reply for Setattr of atime and allow
> the Copy?

This triggered some memories, and indeed we have the VOP_MMAPPED()
implemented only for UFS.  The goal was to confirm to the POSIX
requirement that mmaping the file should update its access time.

I think that
- the VOP is not quite correctly named, but this is minor
- I do not see why it is missed for ZFS and probably tmpfs as well,
  IMO this is a bug
- you can use it for optional update of the access time for generic
  copy_file_range implementation, and then same can be done in
  fs-specific VOP as well.