Commit fc12a722 authored by Yuezhang Mo's avatar Yuezhang Mo Committed by Namjae Jeon

exfat: fix setting uninitialized time to ctime/atime

An uninitialized time is set to ctime/atime in __exfat_write_inode().
It causes xfstests generic/003 and generic/192 to fail.

And since there will be a time gap between setting ctime/atime to
the inode and writing back the inode, so ctime/atime should not be
set again when writing back the inode.

Fixes: 4c72a36e ("exfat: convert to new timestamp accessors")
Signed-off-by: default avatarYuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: default avatarAndy Wu <Andy.Wu@sony.com>
Reviewed-by: default avatarAoyama Wataru <wataru.aoyama@sony.com>
Reviewed-by: default avatarSungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
parent 8f6f76a6
...@@ -56,18 +56,18 @@ int __exfat_write_inode(struct inode *inode, int sync) ...@@ -56,18 +56,18 @@ int __exfat_write_inode(struct inode *inode, int sync)
&ep->dentry.file.create_time, &ep->dentry.file.create_time,
&ep->dentry.file.create_date, &ep->dentry.file.create_date,
&ep->dentry.file.create_time_cs); &ep->dentry.file.create_time_cs);
ts = inode_get_mtime(inode);
exfat_set_entry_time(sbi, &ts, exfat_set_entry_time(sbi, &ts,
&ep->dentry.file.modify_tz, &ep->dentry.file.modify_tz,
&ep->dentry.file.modify_time, &ep->dentry.file.modify_time,
&ep->dentry.file.modify_date, &ep->dentry.file.modify_date,
&ep->dentry.file.modify_time_cs); &ep->dentry.file.modify_time_cs);
inode_set_mtime_to_ts(inode, ts); ts = inode_get_atime(inode);
exfat_set_entry_time(sbi, &ts, exfat_set_entry_time(sbi, &ts,
&ep->dentry.file.access_tz, &ep->dentry.file.access_tz,
&ep->dentry.file.access_time, &ep->dentry.file.access_time,
&ep->dentry.file.access_date, &ep->dentry.file.access_date,
NULL); NULL);
inode_set_atime_to_ts(inode, ts);
/* File size should be zero if there is no cluster allocated */ /* File size should be zero if there is no cluster allocated */
on_disk_size = i_size_read(inode); on_disk_size = i_size_read(inode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment