Skip to content

Commit

Permalink
statx: don't clear STATX_ATIME on SB_RDONLY
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Miklos Szeredi committed May 14, 2020
1 parent 581701b commit 761e28f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 761e28f

Please sign in to comment.