kern/152488: [tmpfs] mtime of file updated when only inode changed (file data not changed)

Anton Yuzhaninov citrin at citrin.ru
Mon Nov 22 17:50:08 UTC 2010


>Number:         152488
>Category:       kern
>Synopsis:       [tmpfs] mtime of file updated when only inode changed (file data not changed)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 22 17:50:08 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Anton Yuzhaninov
>Release:        FreeBSD 9.0-CURRENT i386
>Organization:
openstat.ru
>Environment:
System: FreeBSD citrin.office.vega.ru 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r215180: Sat Nov 13 00:19:31 MSK 2010 citrin at citrin.office.vega.ru:/usr/obj/usr/src/sys/NK i386
>Description:
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

>Fix:
--- tmpfs.patch begins here ---
Index: tmpfs_vnops.c
===================================================================
--- tmpfs_vnops.c	(revision 215543)
+++ tmpfs_vnops.c	(working copy)
@@ -853,8 +853,7 @@
 	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:
--- tmpfs.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list