summaryrefslogtreecommitdiff
path: root/sys/ufs/ext2fs
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2015-04-17 04:43:22 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2015-04-17 04:43:22 +0000
commit520315c9c6bce487b0a975df8204f04a6e8c610e (patch)
tree254581334fcf5ab284ca2e11882093d9dda0ba7b /sys/ufs/ext2fs
parent423b84171151dd257452273b07399e51c37cbbc8 (diff)
Tweaks utimensat/futimens handling to always update ctime, even when both
atime and mtime are UTIME_OMIT (at least for ufs, tmpfs, and ext2fs), and to correctly handle a timestamp of -1. ok millert@
Diffstat (limited to 'sys/ufs/ext2fs')
-rw-r--r--sys/ufs/ext2fs/ext2fs_vnops.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/ufs/ext2fs/ext2fs_vnops.c b/sys/ufs/ext2fs/ext2fs_vnops.c
index c88e6f4617b..13c3356781b 100644
--- a/sys/ufs/ext2fs/ext2fs_vnops.c
+++ b/sys/ufs/ext2fs/ext2fs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_vnops.c,v 1.72 2015/03/14 03:38:52 jsg Exp $ */
+/* $OpenBSD: ext2fs_vnops.c,v 1.73 2015/04/17 04:43:21 guenther Exp $ */
/* $NetBSD: ext2fs_vnops.c,v 1.1 1997/06/11 09:34:09 bouyer Exp $ */
/*
@@ -290,7 +290,9 @@ ext2fs_setattr(void *v)
if (error)
return (error);
}
- if (vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL) {
+ if ((vap->va_vaflags & VA_UTIMES_CHANGE) ||
+ vap->va_atime.tv_nsec != VNOVAL ||
+ vap->va_mtime.tv_nsec != VNOVAL) {
if (vp->v_mount->mnt_flag & MNT_RDONLY)
return (EROFS);
if (cred->cr_uid != ip->i_e2fs_uid &&
@@ -298,17 +300,19 @@ ext2fs_setattr(void *v)
((vap->va_vaflags & VA_UTIMES_NULL) == 0 ||
(error = VOP_ACCESS(vp, VWRITE, cred, p))))
return (error);
- if (vap->va_mtime.tv_sec != VNOVAL)
+ if (vap->va_mtime.tv_nsec != VNOVAL)
ip->i_flag |= IN_CHANGE | IN_UPDATE;
- if (vap->va_atime.tv_sec != VNOVAL) {
+ else if (vap->va_vaflags & VA_UTIMES_CHANGE)
+ ip->i_flag |= IN_CHANGE;
+ if (vap->va_atime.tv_nsec != VNOVAL) {
if (!(vp->v_mount->mnt_flag & MNT_NOATIME) ||
(ip->i_flag & (IN_CHANGE | IN_UPDATE)))
ip->i_flag |= IN_ACCESS;
}
EXT2FS_ITIMES(ip);
- if (vap->va_mtime.tv_sec != VNOVAL)
+ if (vap->va_mtime.tv_nsec != VNOVAL)
ip->i_e2fs_mtime = vap->va_mtime.tv_sec;
- if (vap->va_atime.tv_sec != VNOVAL)
+ if (vap->va_atime.tv_nsec != VNOVAL)
ip->i_e2fs_atime = vap->va_atime.tv_sec;
error = ext2fs_update(ip, 1);
if (error)