summaryrefslogtreecommitdiffstats
path: root/fs/exfat/file.c
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@sandeen.net>2020-04-21 04:13:10 +0200
committerNamjae Jeon <namjae.jeon@samsung.com>2020-04-22 13:14:06 +0200
commit81df1ad40644b706a1cdbd28a1471f9f0c0ea3e8 (patch)
treef91eeffa36abcb5b6c9c67ce33b8e24e07f576d7 /fs/exfat/file.c
parentexfat: properly set s_time_gran (diff)
downloadlinux-81df1ad40644b706a1cdbd28a1471f9f0c0ea3e8.tar.xz
linux-81df1ad40644b706a1cdbd28a1471f9f0c0ea3e8.zip
exfat: truncate atimes to 2s granularity
The timestamp for access_time has double seconds granularity(There is no 10msIncrement field for access_time unlike create/modify_time). exfat's atimes are restricted to only 2s granularity so after we set an atime, round it down to the nearest 2s and set the sub-second component of the timestamp to 0. Signed-off-by: Eric Sandeen <sandeen@sandeen.net> Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Diffstat (limited to 'fs/exfat/file.c')
-rw-r--r--fs/exfat/file.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/exfat/file.c b/fs/exfat/file.c
index 483f683757aa..4f76764165cf 100644
--- a/fs/exfat/file.c
+++ b/fs/exfat/file.c
@@ -273,6 +273,7 @@ int exfat_getattr(const struct path *path, struct kstat *stat,
struct exfat_inode_info *ei = EXFAT_I(inode);
generic_fillattr(inode, stat);
+ exfat_truncate_atime(&stat->atime);
stat->result_mask |= STATX_BTIME;
stat->btime.tv_sec = ei->i_crtime.tv_sec;
stat->btime.tv_nsec = ei->i_crtime.tv_nsec;
@@ -339,6 +340,7 @@ int exfat_setattr(struct dentry *dentry, struct iattr *attr)
}
setattr_copy(inode, attr);
+ exfat_truncate_atime(&inode->i_atime);
mark_inode_dirty(inode);
out: