Update the vnode's access time after an mmap operation on it.
Before this change a copy operation with cp(1) would not update the file access times. According to the POSIX mmap(2) documentation: the st_atime field of the mapped file may be marked for update at any time between the mmap() call and the corresponding munmap() call. The initial read or write reference to a mapped region shall cause the file's st_atime field to be marked for update if it has not already been marked for update.
This commit is contained in:
parent
86c5d92d71
commit
1e3090039d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=150926
@ -1164,6 +1164,18 @@ vm_mmap_vnode(struct thread *td, vm_size_t objsize,
|
||||
}
|
||||
*objp = obj;
|
||||
*flagsp = flags;
|
||||
|
||||
/* Update access time. */
|
||||
if ((vp->v_mount->mnt_flag & MNT_NOATIME) == 0) {
|
||||
struct vattr vattr;
|
||||
struct timespec ts;
|
||||
|
||||
VATTR_NULL(&vattr);
|
||||
vfs_timestamp(&ts);
|
||||
vattr.va_atime = ts;
|
||||
(void)VOP_SETATTR(vp, &vattr, td->td_ucred, td);
|
||||
|
||||
}
|
||||
done:
|
||||
vput(vp);
|
||||
VFS_UNLOCK_GIANT(vfslocked);
|
||||
|
Loading…
Reference in New Issue
Block a user