--- //depot/projects/smpng/sys/kern/vfs_subr.c 2008/11/18 23:25:45 +++ //depot/user/jhb/lock/kern/vfs_subr.c 2008/11/18 23:59:14 @@ -4180,18 +4180,15 @@ /* * Mark for update the access time of the file if the filesystem - * supports VA_MARK_ATIME. This functionality is used by execve + * supports VOP_MARKATIME. This functionality is used by execve * and mmap, so we want to avoid the synchronous I/O implied by * directly setting va_atime for the sake of efficiency. */ void vfs_mark_atime(struct vnode *vp, struct ucred *cred) { - struct vattr atimeattr; if ((vp->v_mount->mnt_flag & (MNT_NOATIME | MNT_RDONLY)) == 0) { - VATTR_NULL(&atimeattr); - atimeattr.va_vaflags |= VA_MARK_ATIME; - (void)VOP_SETATTR(vp, &atimeattr, cred); + (void)VOP_MARKATIME(vp); } } --- //depot/projects/smpng/sys/kern/vnode_if.src 2008/11/03 21:11:59 +++ //depot/user/jhb/lock/kern/vnode_if.src 2008/11/15 16:52:53 @@ -171,6 +171,11 @@ IN struct ucred *cred; }; +%% markatime vp L L L + +vop_markatime { + IN struct vnode *vp; +}; %% read vp L L L --- //depot/projects/smpng/sys/nfsclient/nfs_vnops.c 2008/11/03 21:11:59 +++ //depot/user/jhb/lock/nfsclient/nfs_vnops.c 2008/11/15 16:52:53 @@ -706,9 +706,9 @@ #endif /* - * Setting of flags and marking of atimes are not supported. + * Setting of flags is not supported. */ - if (vap->va_flags != VNOVAL || (vap->va_vaflags & VA_MARK_ATIME)) + if (vap->va_flags != VNOVAL) return (EOPNOTSUPP); /* --- //depot/projects/smpng/sys/sys/vnode.h 2008/11/18 23:25:45 +++ //depot/user/jhb/lock/sys/vnode.h 2008/11/18 23:59:14 @@ -285,7 +285,6 @@ */ #define VA_UTIMES_NULL 0x01 /* utimes argument was NULL */ #define VA_EXCLUSIVE 0x02 /* exclusive create request */ -#define VA_MARK_ATIME 0x04 /* setting atime for execve/mmap */ /* * Flags for ioflag. (high 16 bits used to ask for read-ahead and --- //depot/projects/smpng/sys/ufs/ufs/ufs_vnops.c 2008/11/03 21:11:59 +++ //depot/user/jhb/lock/ufs/ufs/ufs_vnops.c 2008/11/15 16:52:53 @@ -98,6 +98,7 @@ static vop_getattr_t ufs_getattr; static vop_link_t ufs_link; static int ufs_makeinode(int mode, struct vnode *, struct vnode **, struct componentname *); +static vop_markatime_t ufs_markatime; static vop_mkdir_t ufs_mkdir; static vop_mknod_t ufs_mknod; static vop_open_t ufs_open; @@ -491,17 +492,6 @@ ((int)vap->va_bytes != VNOVAL) || (vap->va_gen != VNOVAL)) { return (EINVAL); } - /* - * Mark for update the file's access time for vfs_mark_atime(). - * We are doing this here to avoid some of the checks done - * below -- this operation is done by request of the kernel and - * should bypass some security checks. Things like read-only - * checks get handled by other levels (e.g., ffs_update()). - */ - if (vap->va_vaflags & VA_MARK_ATIME) { - ip->i_flag |= IN_ACCESS; - return (0); - } if (vap->va_flags != VNOVAL) { if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); @@ -663,6 +653,25 @@ } /* + * Mark this file's access time for update for vfs_mark_atime(). This + * is called from execve() and mmap(). + */ +static int +ufs_markatime(ap) + struct vop_markatime_args /* { + struct vnode *a_vp; + } */ *ap; +{ + struct vnode *vp = ap->a_vp; + struct inode *ip = VTOI(vp); + + VI_LOCK(vp); + ip->i_flag |= IN_ACCESS; + VI_UNLOCK(vp); + return (0); +} + +/* * Change the mode on a file. * Inode must be locked before calling. */ @@ -2481,6 +2490,7 @@ .vop_rename = ufs_rename, .vop_rmdir = ufs_rmdir, .vop_setattr = ufs_setattr, + .vop_markatime = ufs_markatime, #ifdef MAC .vop_setlabel = vop_stdsetlabel_ea, #endif @@ -2511,6 +2521,7 @@ .vop_read = VOP_PANIC, .vop_reclaim = ufs_reclaim, .vop_setattr = ufs_setattr, + .vop_markatime = ufs_markatime, #ifdef MAC .vop_setlabel = vop_stdsetlabel_ea, #endif