fusefs: fix some bugs updating atime during close
authorAlan Somers <asomers@FreeBSD.org>
Wed, 20 Sep 2023 21:37:31 +0000 (15:37 -0600)
committerAlan Somers <asomers@FreeBSD.org>
Thu, 21 Sep 2023 14:02:31 +0000 (08:02 -0600)
commitfb619c94c679e939496fe0cf94b8d2cba95e6e63
treebe979bb2b614c74aaf87ee8f6c99c886fe69c57e
parent159599c4a2bbd8fcc4bb7f845afe3e0ea232ab9e
fusefs: fix some bugs updating atime during close

When using cached attributes, we must update a file's atime during
close, if it has been read since the last attribute refresh.  But,

* Don't update atime if we lack write permissions to the file or if the
  file system is readonly.
* If the daemon fails our atime update request for any reason, don't
  report this as a failure for VOP_CLOSE.

PR: 270749
Reported by: Jamie Landeg-Jones <jamie@catflap.org>
MFC after: 1 week
Sponsored by: Axcient
Reviewed by: pfg
Differential Revision: https://reviews.freebsd.org/D41925
sys/fs/fuse/fuse_vnops.c
tests/sys/fs/fusefs/access.cc
tests/sys/fs/fusefs/default_permissions.cc
tests/sys/fs/fusefs/read.cc