summaryrefslogtreecommitdiffstats
path: root/sys/tmpfs/tmpfs_subr.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2015-04-17 04:43:20 +0000
committerguenther <guenther@openbsd.org>2015-04-17 04:43:20 +0000
commit4707cbe35fb28a996a6eab2cd46ba227841d7cb3 (patch)
tree38d71c6ca803f06cc0ad43c0ba4d970df000517a /sys/tmpfs/tmpfs_subr.c
parentdon't call record_login() in monitor when UseLogin is enabled; (diff)
downloadwireguard-openbsd-4707cbe35fb28a996a6eab2cd46ba227841d7cb3.tar.xz
wireguard-openbsd-4707cbe35fb28a996a6eab2cd46ba227841d7cb3.zip
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/tmpfs/tmpfs_subr.c')
-rw-r--r--sys/tmpfs/tmpfs_subr.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/tmpfs/tmpfs_subr.c b/sys/tmpfs/tmpfs_subr.c
index a36eb21abba..ce21637c541 100644
--- a/sys/tmpfs/tmpfs_subr.c
+++ b/sys/tmpfs/tmpfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmpfs_subr.c,v 1.13 2015/02/10 21:56:10 miod Exp $ */
+/* $OpenBSD: tmpfs_subr.c,v 1.14 2015/04/17 04:43:21 guenther Exp $ */
/* $NetBSD: tmpfs_subr.c,v 1.79 2012/03/13 18:40:50 elad Exp $ */
/*
@@ -1112,12 +1112,17 @@ tmpfs_chtimes(struct vnode *vp, const struct timespec *atime,
(error = VOP_ACCESS(vp, VWRITE, cred, p))))
return error;
- if (atime->tv_sec != VNOVAL && atime->tv_nsec != VNOVAL)
+ if (atime->tv_nsec != VNOVAL)
node->tn_atime = *atime;
- if (mtime->tv_sec != VNOVAL && mtime->tv_nsec != VNOVAL)
+ if (mtime->tv_nsec != VNOVAL)
node->tn_mtime = *mtime;
+
+ if (mtime->tv_nsec != VNOVAL || (vaflags & VA_UTIMES_CHANGE))
+ tmpfs_update(VP_TO_TMPFS_NODE(vp), TMPFS_NODE_CHANGED);
+
VN_KNOTE(vp, NOTE_ATTRIB);
+
return 0;
}