Hello all.

This fixes a bug with mtime not updated after file creation on ext2+
file systems. Try it yourself:

# mount -t ext2fs /dev/sd0o /mnt
# cp /tmp/qq /mnt
# ls -l /mnt/qq
-rw-r--r--  1 root  wheel     10 Jan  1  1970 qq
# touch /mnt/qq
-rw-r--r--  1 root  wheel     10 May  6 14:36 qq

This probably does more than needed - I suspect that sometimes
the updated mtime could be already there, but I don't see any real
downside and it makes EX2FS_ITIMES() look more similar to
ufs_itimies(). Opinions? Okays?
--
WBR,
  Vadim Zhukov


Index: inode.h
===================================================================
RCS file: /cvs/src/sys/ufs/ufs/inode.h,v
retrieving revision 1.44
diff -u -p -r1.44 inode.h
--- inode.h     14 Apr 2014 22:25:40 -0000      1.44
+++ inode.h     6 May 2014 10:36:59 -0000
@@ -318,6 +318,8 @@ struct indir {
                (ip)->i_flag |= IN_MODIFIED;                            \
                if ((ip)->i_flag & IN_CHANGE)                           \
                        (ip)->i_e2fs_ctime = time_second;               \
+               if ((ip)->i_flag & IN_UPDATE)                           \
+                       (ip)->i_e2fs_mtime = time_second;               \
                (ip)->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_UPDATE);   \
        }                                                               \
 } while (0)

Reply via email to