Skip to content

Commit

Permalink
exfat: fix setting uninitialized time to ctime/atime
Browse files Browse the repository at this point in the history
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: 4c72a36edd54 ("exfat: convert to new timestamp accessors")

Signed-off-by: Yuezhang Mo <[email protected]>
Reviewed-by: Andy Wu <[email protected]>
Reviewed-by: Aoyama Wataru <[email protected]>
Reviewed-by: Sungjong Seo <[email protected]>
Signed-off-by: Namjae Jeon <[email protected]>
  • Loading branch information
YuezhangMo authored and namjaejeon committed Nov 3, 2023
1 parent 59b349e commit 327699f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,18 @@ int __exfat_write_inode(struct inode *inode, int sync)
&ep->dentry.file.create_date,
&ep->dentry.file.create_time_cs);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0)
ts = inode_get_mtime(inode);
exfat_set_entry_time(sbi, &ts,
&ep->dentry.file.modify_tz,
&ep->dentry.file.modify_time,
&ep->dentry.file.modify_date,
&ep->dentry.file.modify_time_cs);
inode_set_mtime_to_ts(inode, ts);
ts = inode_get_atime(inode);
exfat_set_entry_time(sbi, &ts,
&ep->dentry.file.access_tz,
&ep->dentry.file.access_time,
&ep->dentry.file.access_date,
NULL);
inode_set_atime_to_ts(inode, ts);
#else
exfat_set_entry_time(sbi, &inode->i_mtime,
&ep->dentry.file.modify_tz,
Expand Down

0 comments on commit 327699f

Please sign in to comment.