Skip to content

Commit 5afa7e8

Browse files
committed
fs: fix reporting supported extra file attributes for statx()
statx(2) notes that any attribute that is not indicated as supported by stx_attributes_mask has no usable value. Commits 801e523 ("fs: move generic stat response attr handling to vfs_getattr_nosec") and 712b269 ("fs/stat: Define DAX statx attribute") sets STATX_ATTR_AUTOMOUNT and STATX_ATTR_DAX, respectively, without setting stx_attributes_mask, which can cause xfstests generic/532 to fail. Fix this in the same way as commit 1b9598c ("xfs: fix reporting supported extra file attributes for statx()") Fixes: 801e523 ("fs: move generic stat response attr handling to vfs_getattr_nosec") Fixes: 712b269 ("fs/stat: Define DAX statx attribute") Cc: [email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 4811d99 commit 5afa7e8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

fs/stat.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,20 @@ int vfs_getattr_nosec(const struct path *path, struct kstat *stat,
8686
/* SB_NOATIME means filesystem supplies dummy atime value */
8787
if (inode->i_sb->s_flags & SB_NOATIME)
8888
stat->result_mask &= ~STATX_ATIME;
89+
90+
/*
91+
* Note: If you add another clause to set an attribute flag, please
92+
* update attributes_mask below.
93+
*/
8994
if (IS_AUTOMOUNT(inode))
9095
stat->attributes |= STATX_ATTR_AUTOMOUNT;
9196

9297
if (IS_DAX(inode))
9398
stat->attributes |= STATX_ATTR_DAX;
9499

100+
stat->attributes_mask |= (STATX_ATTR_AUTOMOUNT |
101+
STATX_ATTR_DAX);
102+
95103
mnt_userns = mnt_user_ns(path->mnt);
96104
if (inode->i_op->getattr)
97105
return inode->i_op->getattr(mnt_userns, path, stat,

0 commit comments

Comments
 (0)