From: Andrew Morton Signed-off-by: Christoph Hellwig Cc: Anton Altaparmakov Signed-off-by: Andrew Morton --- fs/ntfs/file.c | 2 +- fs/ntfs/inode.c | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff -puN fs/ntfs/file.c~replace-inode_update_time-with-file_update_time-switch-ntfs-to-touch_atime fs/ntfs/file.c --- devel/fs/ntfs/file.c~replace-inode_update_time-with-file_update_time-switch-ntfs-to-touch_atime 2005-11-06 22:08:34.000000000 -0800 +++ devel-akpm/fs/ntfs/file.c 2005-11-06 22:08:34.000000000 -0800 @@ -2173,7 +2173,7 @@ static ssize_t ntfs_file_aio_write_noloc err = remove_suid(file->f_dentry); if (err) goto out; - inode_update_time(inode, 1); + file_update_time(file); written = ntfs_file_buffered_write(iocb, iov, nr_segs, pos, ppos, count); out: diff -puN fs/ntfs/inode.c~replace-inode_update_time-with-file_update_time-switch-ntfs-to-touch_atime fs/ntfs/inode.c --- devel/fs/ntfs/inode.c~replace-inode_update_time-with-file_update_time-switch-ntfs-to-touch_atime 2005-11-06 22:08:51.000000000 -0800 +++ devel-akpm/fs/ntfs/inode.c 2005-11-06 22:08:51.000000000 -0800 @@ -2767,7 +2767,25 @@ unm_done: up_write(&ni->runlist.lock); done: /* Update the mtime and ctime on the base inode. */ - inode_update_time(VFS_I(base_ni), 1); + /* normally ->truncate shouldn't update ctime or mtime, + * but ntfs did before so it got a copy & paste version + * of file_update_time. one day someone should fix this + * for real. + */ + if (!IS_NOCMTIME(VFS_I(base_ni)) && !IS_RDONLY(VFS_I(base_ni))) { + struct timespec now = current_fs_time(VFS_I(base_ni)->i_sb); + int sync_it = 0; + + if (!timespec_equal(&VFS_I(base_ni)->i_mtime, &now) || + !timespec_equal(&VFS_I(base_ni)->i_ctime, &now)) + sync_it = 1; + VFS_I(base_ni)->i_mtime = now; + VFS_I(base_ni)->i_ctime = now; + + if (sync_it) + mark_inode_dirty_sync(VFS_I(base_ni)); + } + if (likely(!err)) { NInoClearTruncateFailed(ni); ntfs_debug("Done."); _