[Unionfs] read mtime bug

hooanon05 at yahoo.co.jp hooanon05 at yahoo.co.jp
Sun Mar 12 19:41:38 EST 2006


A bug was born when mmap patch was applied.
The timestamp(mtime) is updated in read systemcall.

unionfs /dev/shm/u unionfs rw,dirs=/dev/shm/rw=rw:/dev/shm/ro=ro,debug=0,delete=whiteout,copyup=preserve 0 0
+ cd /dev/shm/u
+ touch -d yesterday a
+ ls -l a
-rw-r--r--  1 jro jro 0 Mar 12 07:00 a
+ cat a
+ ls -l a
-rw-r--r--  1 jro jro 0 Mar 13 07:00 a

Junjiro Okajima


--- unionfs-20060308-2131/file.c	10 Mar 2006 13:47:41 -0000	1.1
+++ unionfs-20060308-2131/file.c	13 Mar 2006 21:25:09 -0000	1.3
@@ -86,8 +86,6 @@ ssize_t __unionfs_read(struct file * fil
 
 	err = hidden_file->f_op->read(hidden_file, buf, count, &pos);
 	*ppos = pos;
-	if (err >= 0)
-		file_update_time(ftohf(file));
 
       out:
 	fist_print_file("leaving __unionfs_read()", file);
@@ -108,11 +106,11 @@ ssize_t unionfs_read(struct file * file,
 
 #ifdef UNIONFS_MMAP
 	err = generic_file_read(file, buf, count, ppos);
+	if (err >= 0)
+		file_accessed(ftohf(file));
 #else
 	err = __unionfs_read(file, buf, count, ppos);
 #endif
-	if (err >= 0)
-		file_update_time(ftohf(file));
 
       out:
 



More information about the unionfs mailing list