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
71fe27e3b4
commit
c066055957
@ -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…
x
Reference in New Issue
Block a user