Obey MNT_RELATIME, the only addition is that mkdir in ufs sets IN_ACCESS too.

This commit is contained in:
christos 2011-11-18 21:18:50 +00:00
parent 953ea7db3e
commit d11ea3ea81
9 changed files with 59 additions and 24 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: nilfs_vnops.c,v 1.15 2011/10/16 12:41:45 hannken Exp $ */
/* $NetBSD: nilfs_vnops.c,v 1.16 2011/11/18 21:18:50 christos Exp $ */
/*
* Copyright (c) 2008, 2009 Reinoud Zandijk
@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifndef lint
__KERNEL_RCSID(0, "$NetBSD: nilfs_vnops.c,v 1.15 2011/10/16 12:41:45 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: nilfs_vnops.c,v 1.16 2011/11/18 21:18:50 christos Exp $");
#endif /* not lint */
@ -280,6 +280,8 @@ return EIO;
/* mark node changed and request update */
nilfs_node->i_flags |= IN_CHANGE | IN_UPDATE;
if (vp->v_mount->mnt_flag & MNT_RELATIME)
nilfs_node->i_flags |= IN_ACCESS;
/*
* XXX TODO FFS has code here to reset setuid & setgid when we're not

View File

@ -1,4 +1,4 @@
/* $NetBSD: ptyfs_vnops.c,v 1.36 2011/09/16 18:43:44 christos Exp $ */
/* $NetBSD: ptyfs_vnops.c,v 1.37 2011/11/18 21:18:50 christos Exp $ */
/*
* Copyright (c) 1993, 1995
@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ptyfs_vnops.c,v 1.36 2011/09/16 18:43:44 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: ptyfs_vnops.c,v 1.37 2011/11/18 21:18:50 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -426,8 +426,11 @@ ptyfs_setattr(void *v)
if (vap->va_atime.tv_sec != VNOVAL)
if (!(vp->v_mount->mnt_flag & MNT_NOATIME))
ptyfs->ptyfs_flag |= PTYFS_ACCESS;
if (vap->va_mtime.tv_sec != VNOVAL)
if (vap->va_mtime.tv_sec != VNOVAL) {
ptyfs->ptyfs_flag |= PTYFS_CHANGE | PTYFS_MODIFY;
if (vp->v_mount->mnt_flag & MNT_RELATIME)
ptyfs->ptyfs_flag |= PTYFS_ACCESS;
}
if (vap->va_birthtime.tv_sec != VNOVAL)
ptyfs->ptyfs_birthtime = vap->va_birthtime;
ptyfs->ptyfs_flag |= PTYFS_CHANGE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: puffs_vnops.c,v 1.161 2011/10/30 13:24:13 hannken Exp $ */
/* $NetBSD: puffs_vnops.c,v 1.162 2011/11/18 21:18:50 christos Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.161 2011/10/30 13:24:13 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.162 2011/11/18 21:18:50 christos Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@ -1967,6 +1967,8 @@ puffs_vnop_write(void *v)
origoff = uio->uio_offset;
while (uio->uio_resid > 0) {
if (vp->v_mount->mnt_flag & MNT_RELATIME)
uflags |= PUFFS_UPDATEATIME;
uflags |= PUFFS_UPDATECTIME;
uflags |= PUFFS_UPDATEMTIME;
oldoff = uio->uio_offset;

View File

@ -1,4 +1,4 @@
/* $NetBSD: tmpfs_vnops.c,v 1.92 2011/09/27 01:32:21 christos Exp $ */
/* $NetBSD: tmpfs_vnops.c,v 1.93 2011/11/18 21:18:51 christos Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.92 2011/09/27 01:32:21 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.93 2011/11/18 21:18:51 christos Exp $");
#include <sys/param.h>
#include <sys/dirent.h>
@ -2465,8 +2465,11 @@ tmpfs_getpages(void *v)
if ((vp->v_mount->mnt_flag & MNT_NOATIME) == 0)
node->tn_status |= TMPFS_NODE_ACCESSED;
if ((access_type & VM_PROT_WRITE) != 0)
if ((access_type & VM_PROT_WRITE) != 0) {
node->tn_status |= TMPFS_NODE_MODIFIED;
if (vp->v_mount->mnt_flag & MNT_RELATIME)
node->tn_status |= TMPFS_NODE_ACCESSED;
}
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: udf_vnops.c,v 1.68 2011/10/18 20:20:29 hannken Exp $ */
/* $NetBSD: udf_vnops.c,v 1.69 2011/11/18 21:18:51 christos Exp $ */
/*
* Copyright (c) 2006, 2008 Reinoud Zandijk
@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.68 2011/10/18 20:20:29 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.69 2011/11/18 21:18:51 christos Exp $");
#endif /* not lint */
@ -376,6 +376,8 @@ udf_write(void *v)
/* mark node changed and request update */
udf_node->i_flags |= IN_CHANGE | IN_UPDATE;
if (vp->v_mount->mnt_flag & MNT_RELATIME)
udf_node->i_flags |= IN_ACCESS;
/*
* XXX TODO FFS has code here to reset setuid & setgid when we're not
@ -977,6 +979,8 @@ udf_chown(struct vnode *vp, uid_t new_uid, gid_t new_gid,
/* mark node changed */
udf_node->i_flags |= IN_CHANGE;
if (vp->v_mount->mnt_flag & MNT_RELATIME)
udf_node->i_flags |= IN_ACCESS;
return 0;
}
@ -1013,6 +1017,8 @@ udf_chmod(struct vnode *vp, mode_t mode, kauth_cred_t cred)
/* mark node changed */
udf_node->i_flags |= IN_CHANGE;
if (vp->v_mount->mnt_flag & MNT_RELATIME)
udf_node->i_flags |= IN_ACCESS;
return 0;
}
@ -1063,6 +1069,8 @@ udf_chsize(struct vnode *vp, u_quad_t newsize, kauth_cred_t cred)
if (error == 0) {
/* mark change */
udf_node->i_flags |= IN_CHANGE | IN_MODIFY;
if (vp->v_mount->mnt_flag & MNT_RELATIME)
udf_node->i_flags |= IN_ACCESS;
VN_KNOTE(vp, NOTE_ATTRIB | (extended ? NOTE_EXTEND : 0));
udf_update(vp, NULL, NULL, NULL, 0);
}
@ -1116,8 +1124,11 @@ udf_chtimes(struct vnode *vp,
if (atime->tv_sec != VNOVAL)
if (!(vp->v_mount->mnt_flag & MNT_NOATIME))
udf_node->i_flags |= IN_ACCESS;
if ((mtime->tv_sec != VNOVAL) || (birthtime->tv_sec != VNOVAL))
if ((mtime->tv_sec != VNOVAL) || (birthtime->tv_sec != VNOVAL)) {
udf_node->i_flags |= IN_CHANGE | IN_UPDATE;
if (vp->v_mount->mnt_flag & MNT_RELATIME)
udf_node->i_flags |= IN_ACCESS;
}
return udf_update(vp, atime, mtime, birthtime, 0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext2fs_readwrite.c,v 1.57 2011/06/12 03:36:00 rmind Exp $ */
/* $NetBSD: ext2fs_readwrite.c,v 1.58 2011/11/18 21:18:51 christos Exp $ */
/*-
* Copyright (c) 1993
@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ext2fs_readwrite.c,v 1.57 2011/06/12 03:36:00 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: ext2fs_readwrite.c,v 1.58 2011/11/18 21:18:51 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -374,6 +374,8 @@ ext2fs_write(void *v)
out:
ip->i_flag |= IN_CHANGE | IN_UPDATE;
if (vp->v_mount->mnt_flag & MNT_RELATIME)
ip->i_flag |= IN_ACCESS;
if (resid > uio->uio_resid && ap->a_cred &&
kauth_authorize_generic(ap->a_cred, KAUTH_GENERIC_ISSUSER, NULL))
ip->i_e2fs_mode &= ~(ISUID | ISGID);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext2fs_vnops.c,v 1.100 2011/07/12 16:59:48 dholland Exp $ */
/* $NetBSD: ext2fs_vnops.c,v 1.101 2011/11/18 21:18:51 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.100 2011/07/12 16:59:48 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.101 2011/11/18 21:18:51 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -431,8 +431,11 @@ ext2fs_setattr(void *v)
if (vap->va_atime.tv_sec != VNOVAL)
if (!(vp->v_mount->mnt_flag & MNT_NOATIME))
ip->i_flag |= IN_ACCESS;
if (vap->va_mtime.tv_sec != VNOVAL)
if (vap->va_mtime.tv_sec != VNOVAL) {
ip->i_flag |= IN_CHANGE | IN_UPDATE;
if (vp->v_mount->mnt_flag & MNT_RELATIME)
ip->i_flag |= IN_ACCESS;
}
error = ext2fs_update(vp, &vap->va_atime, &vap->va_mtime,
UPDATE_WAIT);
if (error)
@ -1282,6 +1285,8 @@ ext2fs_symlink(void *v)
if (error)
goto bad;
ip->i_flag |= IN_CHANGE | IN_UPDATE;
if (vp->v_mount->mnt_flag & MNT_RELATIME)
ip->i_flag |= IN_ACCESS;
uvm_vnp_setsize(vp, len);
} else
error = vn_rdwr(UIO_WRITE, vp, ap->a_target, len, (off_t)0,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_readwrite.c,v 1.99 2011/07/11 08:27:41 hannken Exp $ */
/* $NetBSD: ufs_readwrite.c,v 1.100 2011/11/18 21:18:52 christos Exp $ */
/*-
* Copyright (c) 1993
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.99 2011/07/11 08:27:41 hannken Exp $");
__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.100 2011/11/18 21:18:52 christos Exp $");
#ifdef LFS_READWRITE
#define FS struct lfs
@ -507,6 +507,8 @@ WRITE(void *v)
*/
out:
ip->i_flag |= IN_CHANGE | IN_UPDATE;
if (vp->v_mount->mnt_flag & MNT_RELATIME)
ip->i_flag |= IN_ACCESS;
if (resid > uio->uio_resid && ap->a_cred &&
kauth_authorize_generic(ap->a_cred, KAUTH_GENERIC_ISSUSER, NULL)) {
ip->i_mode &= ~(ISUID | ISGID);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_vnops.c,v 1.205 2011/09/27 02:10:32 christos Exp $ */
/* $NetBSD: ufs_vnops.c,v 1.206 2011/11/18 21:18:52 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.205 2011/09/27 02:10:32 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.206 2011/11/18 21:18:52 christos Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@ -638,8 +638,11 @@ ufs_setattr(void *v)
if (vap->va_atime.tv_sec != VNOVAL)
if (!(vp->v_mount->mnt_flag & MNT_NOATIME))
ip->i_flag |= IN_ACCESS;
if (vap->va_mtime.tv_sec != VNOVAL)
if (vap->va_mtime.tv_sec != VNOVAL) {
ip->i_flag |= IN_CHANGE | IN_UPDATE;
if (vp->v_mount->mnt_flag & MNT_RELATIME)
ip->i_flag |= IN_ACCESS;
}
if (vap->va_birthtime.tv_sec != VNOVAL &&
ip->i_ump->um_fstype == UFS2) {
ip->i_ffs2_birthtime = vap->va_birthtime.tv_sec;
@ -2092,7 +2095,7 @@ ufs_mkdir(void *v)
goto bad;
ip->i_size = dirblksiz;
DIP_ASSIGN(ip, size, dirblksiz);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE;
uvm_vnp_setsize(tvp, ip->i_size);
memcpy((void *)bp->b_data, (void *)&dirtemplate, sizeof dirtemplate);
@ -2286,6 +2289,8 @@ ufs_symlink(void *v)
DIP_ASSIGN(ip, size, len);
uvm_vnp_setsize(vp, ip->i_size);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
if (vp->v_mount->mnt_flag & MNT_RELATIME)
ip->i_flag |= IN_ACCESS;
UFS_WAPBL_UPDATE(vp, NULL, NULL, 0);
} else
error = vn_rdwr(UIO_WRITE, vp, ap->a_target, len, (off_t)0,