Bug 152488

Summary: [tmpfs] [patch] mtime of file updated when only inode changed (file data not changed)
Product: Base System Reporter: citrin
Component: kernAssignee: Alan Cox <alc>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 9.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
tmpfs.patch none

Description citrin 2010-11-22 17:50:08 UTC
According to stat(2), mtime (st_mtim) changed by the mknod(2), utimes(2), read(2) and readv(2) system calls (when file data modified).

It seems to be true for ufs, but not true for tmpfs. On tmpfs mtime updated even if file data is not modified.

How-To-Repeat: 
:~> sudo mount -t tmpfs tmpfs tmp && cd tmp
:~/tmp> touch -m -t 197001010000 xxx
:~/tmp> stat -x xxx | egrep '(Modify|Change)'
Modify: Thu Jan  1 00:00:00 1970
Change: Mon Nov 22 19:43:49 2010
:~/tmp> ln xxx xxx2
:~/tmp> stat -x xxx | egrep '(Modify|Change)'
Modify: Thu Jan  1 00:00:00 1970
Change: Mon Nov 22 19:44:40 2010
:~/tmp> rm xxx2
:~/tmp> stat -x xxx | egrep '(Modify|Change)'
Modify: Mon Nov 22 19:44:54 2010
Change: Mon Nov 22 19:44:54 2010

But expected:
Modify: Thu Jan  1 00:00:00 1970
Change: Mon Nov 22 19:44:54 2010
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2010-11-22 17:55:10 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 2 Alexander Best freebsd_committer freebsd_triage 2010-11-22 18:58:11 UTC
this might me related to #29421 (closed).

cheers.
alex

-- 
a13x
Comment 3 dfilter service freebsd_committer freebsd_triage 2011-02-19 21:04:41 UTC
Author: alc
Date: Sat Feb 19 21:04:36 2011
New Revision: 218863
URL: http://svn.freebsd.org/changeset/base/218863

Log:
  tmpfs_remove() isn't modifying the file's data, so it shouldn't set
  TMPFS_NODE_MODIFIED on the node.
  
  PR:		152488
  Submitted by:	Anton Yuzhaninov
  Reviewed by:	kib
  MFC after:	1 week

Modified:
  head/sys/fs/tmpfs/tmpfs_vnops.c

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==============================================================================
--- head/sys/fs/tmpfs/tmpfs_vnops.c	Sat Feb 19 17:44:13 2011	(r218862)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c	Sat Feb 19 21:04:36 2011	(r218863)
@@ -853,8 +853,7 @@ tmpfs_remove(struct vop_remove_args *v)
 	tmpfs_free_dirent(tmp, de, TRUE);
 
 	if (node->tn_links > 0)
-		node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | \
-	    TMPFS_NODE_MODIFIED;
+		node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED;
 	error = 0;
 
 out:
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 4 Alan Cox freebsd_committer freebsd_triage 2011-02-19 21:06:57 UTC
State Changed
From-To: open->patched

Change applied to HEAD.
Comment 5 Alexander Best freebsd_committer freebsd_triage 2011-11-21 23:15:53 UTC
Responsible Changed
From-To: freebsd-fs->alc

Over to Alan as MFC reminder.
Comment 6 dfilter service freebsd_committer freebsd_triage 2011-12-04 01:16:06 UTC
Author: alc
Date: Sun Dec  4 01:15:52 2011
New Revision: 228249
URL: http://svn.freebsd.org/changeset/base/228249

Log:
  MFC r218863
    tmpfs_remove() isn't modifying the file's data, so it shouldn't set
    TMPFS_NODE_MODIFIED on the node.
  
  PR:		152488

Modified:
  stable/8/sys/fs/tmpfs/tmpfs_vnops.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/fs/tmpfs/tmpfs_vnops.c
==============================================================================
--- stable/8/sys/fs/tmpfs/tmpfs_vnops.c	Sat Dec  3 23:36:36 2011	(r228248)
+++ stable/8/sys/fs/tmpfs/tmpfs_vnops.c	Sun Dec  4 01:15:52 2011	(r228249)
@@ -823,8 +823,7 @@ tmpfs_remove(struct vop_remove_args *v)
 	tmpfs_free_dirent(tmp, de, TRUE);
 
 	if (node->tn_links > 0)
-		node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | \
-	    TMPFS_NODE_MODIFIED;
+		node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED;
 	error = 0;
 
 out:
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 7 dfilter service freebsd_committer freebsd_triage 2011-12-04 01:22:36 UTC
Author: alc
Date: Sun Dec  4 01:22:22 2011
New Revision: 228250
URL: http://svn.freebsd.org/changeset/base/228250

Log:
  MFC r218863
    tmpfs_remove() isn't modifying the file's data, so it shouldn't set
    TMPFS_NODE_MODIFIED on the node.
  
  PR:		152488

Modified:
  stable/7/sys/fs/tmpfs/tmpfs_vnops.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/fs/tmpfs/tmpfs_vnops.c
==============================================================================
--- stable/7/sys/fs/tmpfs/tmpfs_vnops.c	Sun Dec  4 01:15:52 2011	(r228249)
+++ stable/7/sys/fs/tmpfs/tmpfs_vnops.c	Sun Dec  4 01:22:22 2011	(r228250)
@@ -791,8 +791,7 @@ tmpfs_remove(struct vop_remove_args *v)
 	tmpfs_free_dirent(tmp, de, TRUE);
 
 	if (node->tn_links > 0)
-		node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | \
-	    TMPFS_NODE_MODIFIED;
+		node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED;
 	error = 0;
 
 out:
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 8 Alan Cox freebsd_committer freebsd_triage 2011-12-07 07:09:12 UTC
State Changed
From-To: patched->closed

The patch has been applied to all active branches.