summaryrefslogtreecommitdiffstats
path: root/fs/stat.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2020-05-14 16:44:24 +0200
committerMiklos Szeredi <mszeredi@redhat.com>2020-05-14 16:44:24 +0200
commit761e28fa270a3cc0f2ae9a0f4f778239b91a9df2 (patch)
tree0b1315f97c6343a16270716a6c83e04886558ba6 /fs/stat.c
parent581701b7efd60ba13d8a7eed60cbdd7fefaf6696 (diff)
downloadlinux-stable-761e28fa270a3cc0f2ae9a0f4f778239b91a9df2.tar.gz
linux-stable-761e28fa270a3cc0f2ae9a0f4f778239b91a9df2.tar.bz2
linux-stable-761e28fa270a3cc0f2ae9a0f4f778239b91a9df2.zip
statx: don't clear STATX_ATIME on SB_RDONLY
IS_NOATIME(inode) is defined as __IS_FLG(inode, SB_RDONLY|SB_NOATIME), so generic_fillattr() will clear STATX_ATIME from the result_mask if the super block is marked read only. This was probably not the intention, so fix to only clear STATX_ATIME if the fs doesn't support atime at all. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Acked-by: David Howells <dhowells@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/stat.c')
-rw-r--r--fs/stat.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/stat.c b/fs/stat.c
index a6709e7ba71d..f7f07d1b73cb 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -73,7 +73,8 @@ int vfs_getattr_nosec(const struct path *path, struct kstat *stat,
query_flags &= KSTAT_QUERY_FLAGS;
/* allow the fs to override these if it really wants to */
- if (IS_NOATIME(inode))
+ /* SB_NOATIME means filesystem supplies dummy atime value */
+ if (inode->i_sb->s_flags & SB_NOATIME)
stat->result_mask &= ~STATX_ATIME;
if (IS_AUTOMOUNT(inode))
stat->attributes |= STATX_ATTR_AUTOMOUNT;