svn commit: r277969 - head/sys/fs/tmpfs
Konstantin Belousov
kib at FreeBSD.org
Sat Jan 31 12:27:20 UTC 2015
Author: kib
Date: Sat Jan 31 12:27:18 2015
New Revision: 277969
URL: https://svnweb.freebsd.org/changeset/base/277969
Log:
POSIX states that write(2) "shall mark for update the last data
modification and last file status change timestamps of the file".
Currently, tmpfs only modifies ctime when file was extended. Since
r277828 followed tmpfs_write(), mmaped writes also do not modify
ctime.
Fix this, by updating both ctime and mtime for writes to tmpfs files.
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Modified:
head/sys/fs/tmpfs/tmpfs_subr.c
head/sys/fs/tmpfs/tmpfs_vnops.c
Modified: head/sys/fs/tmpfs/tmpfs_subr.c
==============================================================================
--- head/sys/fs/tmpfs/tmpfs_subr.c Sat Jan 31 12:17:07 2015 (r277968)
+++ head/sys/fs/tmpfs/tmpfs_subr.c Sat Jan 31 12:27:18 2015 (r277969)
@@ -1434,7 +1434,8 @@ tmpfs_check_mtime(struct vnode *vp)
if ((obj->flags & OBJ_TMPFS_DIRTY) != 0) {
obj->flags &= ~OBJ_TMPFS_DIRTY;
node = VP_TO_TMPFS_NODE(vp);
- node->tn_status |= TMPFS_NODE_MODIFIED;
+ node->tn_status |= TMPFS_NODE_MODIFIED |
+ TMPFS_NODE_CHANGED;
}
VM_OBJECT_WUNLOCK(obj);
}
Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==============================================================================
--- head/sys/fs/tmpfs/tmpfs_vnops.c Sat Jan 31 12:17:07 2015 (r277968)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c Sat Jan 31 12:27:18 2015 (r277969)
@@ -483,7 +483,7 @@ tmpfs_write(struct vop_write_args *v)
error = uiomove_object(node->tn_reg.tn_aobj, node->tn_size, uio);
node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED |
- (extended ? TMPFS_NODE_CHANGED : 0);
+ TMPFS_NODE_CHANGED;
if (node->tn_mode & (S_ISUID | S_ISGID)) {
if (priv_check_cred(v->a_cred, PRIV_VFS_RETAINSUGID, 0))
node->tn_mode &= ~(S_ISUID | S_ISGID);
More information about the svn-src-head
mailing list