]> Git Repo - J-linux.git/commitdiff
exfat: fix setting uninitialized time to ctime/atime
authorYuezhang Mo <[email protected]>
Tue, 31 Oct 2023 09:52:13 +0000 (17:52 +0800)
committerNamjae Jeon <[email protected]>
Fri, 3 Nov 2023 13:24:07 +0000 (22:24 +0900)
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]>
fs/exfat/inode.c

index 875234179d1f61e9e49a5e79700334159d5dc189..e7ff58b8e68c78d53c01c8126cd1b6276c632a8c 100644 (file)
@@ -56,18 +56,18 @@ int __exfat_write_inode(struct inode *inode, int sync)
                        &ep->dentry.file.create_time,
                        &ep->dentry.file.create_date,
                        &ep->dentry.file.create_time_cs);
+       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);
 
        /* File size should be zero if there is no cluster allocated */
        on_disk_size = i_size_read(inode);
This page took 0.061355 seconds and 4 git commands to generate.