Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Jan 2015 12:27:19 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r277969 - head/sys/fs/tmpfs
Message-ID:  <201501311227.t0VCRJQb032862@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501311227.t0VCRJQb032862>