This reflects the actual functionality of the VOP. While there, add the explicit struct timespec argument for the VOP allowing the caller to set specific atime, not just request an update for it. Requested by: rmacklem
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
What is not clear to me, should ufs_itimes() only use the passed timespec for atime update, or it shall be used for all times as I did in the initial version of the patch.
Perhaps this is the question to Rick, since I believe the only caller with tsa != NULL would be nfs server.
Had considered changing this name too, glad to see this.
What's the expected semantics on passing an explicit atime? The UFS implementation here may cause setting the modified and created times in addition to the access one depending on present inode flags. Is that intended?
I would say that, if VOP_SET_ATIME() is only being used for atime,
then the tsa != NULL should only apply to atime.
(The NFS client can provide separate times for atime/mtime/birthtime,
but that results in multiple VOP_SETATTR() calls for each. It is the atime
case for read-only file systems like ZFS snapshots that caused the problem
where the server would reply EROFS for attempting to update atime for
a clone/copy from the read-only fs.)
This looks ok to me, although I'll admit I am not
conversant with UFS semantics, so I'll leave that
to others.
All existing callers pass tsa == NULL, so the intent is that the semantic does not change.
It is the question whether your case is served when tsa != NULL is provided.
I guess it does. I don't know UFS, but it does seem "inefficient" to first do
UFS_INODE_SET_FLAG_SHARED(), which locks/unlocks the vnode interlock and
then call ufs_itimes(), which locks the vnode interlock again and calls ufs_itimes_locked().
Maybe ufs_update_atime() should..
if (ap->a_ts != NULL) {
VI_LOCK(vp);
ITOV(vp)->i_flags |= IN_ACCESS;
ufs_itimes_locked(vp, ap->a_ts);
VI_UNLOCK(vp);
} else
UFS_INODE_SET_FLAG_SHARED(ip, IN_ACCESS);Instead of what is in line#852-854. But I doubt it makes any
difference from a correctness point of view.
| sys/ufs/ufs/ufs_vnops.c | ||
|---|---|---|
| 169 | Same question as @olce above: when tsa != NULL, would we ever expect IN_UPDATE/IN_CHANGE to be set on the inode, and if so would the desired behavior always be to set them to the current time instead of tsa? Also, it sounds as though the tsa != NULL case is in support of some upcoming NFS feature? | |
| sys/ufs/ufs/ufs_vnops.c | ||
|---|---|---|
| 169 | Not an upcoming feature. Commit b5815ee99a01 is The NFS problem/fix is somewhat convoluted.. The FreeBSD NFSv4.2 server does a VOP_SETATTR() of For VOP_UPDATE_ATIME() { VOP_MMAPPED() renamed } Basically, the difference between using VOP_SETATTR() | |