diff options
author | jhb <jhb@FreeBSD.org> | 2009-01-21 14:42:00 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2009-01-21 14:42:00 +0000 |
commit | 47455a7b41fddec8ed401d12470434bd77477189 (patch) | |
tree | e58a2689a5a9b34097c0a3907a9c3f83d2c56940 /sys/ufs | |
parent | fd1ff02af8d6981027dd9a4fa0fe479822e179a4 (diff) | |
download | FreeBSD-src-47455a7b41fddec8ed401d12470434bd77477189.zip FreeBSD-src-47455a7b41fddec8ed401d12470434bd77477189.tar.gz |
Move the VA_MARKATIME flag for VOP_SETATTR() out into its own VOP:
VOP_MARKATIME() since unlike the rest of VOP_SETATTR(), VA_MARKATIME
can be performed while holding a shared vnode lock (the same functionality
is done internally by VOP_READ which can run with a shared vnode lock).
Add missing locking of the vnode interlock to the ufs implementation and
remove a special note and test from the NFS client about not supporting the
feature.
Inspired by: ups
Tested by: pho
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 7b639e8..3fc16a1 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -98,6 +98,7 @@ static vop_create_t ufs_create; 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 @@ ufs_setattr(ap) ((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 @@ ufs_setattr(ap) } /* + * 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 @@ struct vop_vector ufs_vnodeops = { .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 @@ struct vop_vector ufs_fifoops = { .vop_read = VOP_PANIC, .vop_reclaim = ufs_reclaim, .vop_setattr = ufs_setattr, + .vop_markatime = ufs_markatime, #ifdef MAC .vop_setlabel = vop_stdsetlabel_ea, #endif |