From: Dave Chinner Date: Tue, 6 Apr 2021 14:01:00 +0000 (-0700) Subject: xfs: eager inode attr fork init needs attr feature awareness X-Git-Tag: v5.15~1167^2~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2442ee15bb1e726e0db1b90faf02211f88fb5d71;p=platform%2Fkernel%2Flinux-starfive.git xfs: eager inode attr fork init needs attr feature awareness The pitfalls of regression testing on a machine without realising that selinux was disabled. Only set the attr fork during inode allocation if the attr feature bits are already set on the superblock. Fixes: e6a688c33238 ("xfs: initialise attr fork on inode create") Signed-off-by: Dave Chinner Tested-by: Brian Foster Reviewed-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Darrick J. Wong Reviewed-by: Allison Henderson --- diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 9100a9b7..7c5433e 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -872,7 +872,7 @@ xfs_init_new_inode( * this saves us from needing to run a separate transaction to set the * fork offset in the immediate future. */ - if (init_xattrs) { + if (init_xattrs && xfs_sb_version_hasattr(&mp->m_sb)) { ip->i_forkoff = xfs_default_attroffset(ip) >> 3; ip->i_afp = xfs_ifork_alloc(XFS_DINODE_FMT_EXTENTS, 0); }