Skip to content

Commit 1b9598c

Browse files
mcgrofdjwong
authored andcommitted
xfs: 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. Commit 5f955f2 ("xfs: report crtime and attribute flags to statx") added support for informing userspace of extra file attributes but forgot to list these flags as supported making reporting them rather useless for the pedantic userspace author. $ git describe --contains 5f955f2 v4.11-rc6~5^2^2~2 Fixes: 5f955f2 ("xfs: report crtime and attribute flags to statx") Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> [darrick: add a comment reminding people to keep attributes_mask up to date] Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
1 parent 3d129e1 commit 1b9598c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

fs/xfs/xfs_iops.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,13 +531,21 @@ xfs_vn_getattr(
531531
}
532532
}
533533

534+
/*
535+
* Note: If you add another clause to set an attribute flag, please
536+
* update attributes_mask below.
537+
*/
534538
if (ip->i_d.di_flags & XFS_DIFLAG_IMMUTABLE)
535539
stat->attributes |= STATX_ATTR_IMMUTABLE;
536540
if (ip->i_d.di_flags & XFS_DIFLAG_APPEND)
537541
stat->attributes |= STATX_ATTR_APPEND;
538542
if (ip->i_d.di_flags & XFS_DIFLAG_NODUMP)
539543
stat->attributes |= STATX_ATTR_NODUMP;
540544

545+
stat->attributes_mask |= (STATX_ATTR_IMMUTABLE |
546+
STATX_ATTR_APPEND |
547+
STATX_ATTR_NODUMP);
548+
541549
switch (inode->i_mode & S_IFMT) {
542550
case S_IFBLK:
543551
case S_IFCHR:

0 commit comments

Comments
 (0)