xfs: set XFS_FEAT_NLINK correctly
authorDave Chinner <dchinner@redhat.com>
Tue, 14 Feb 2023 21:25:28 +0000 (13:25 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Feb 2023 11:57:04 +0000 (12:57 +0100)
[ Upstream commit dd0d2f9755191690541b09e6385d0f8cd8bc9d8f ]

While xfs_has_nlink() is not used in kernel, it is used in userspace
(e.g. by xfs_db) so we need to set the XFS_FEAT_NLINK flag correctly
in xfs_sb_version_to_features().

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/xfs/libxfs/xfs_sb.c

index e58349be78bd5007fd052b6f1c20385f599226ee..72c05485c8706ab3e8f302e8ed9e18e944679f71 100644 (file)
@@ -70,6 +70,8 @@ xfs_sb_version_to_features(
        /* optional V4 features */
        if (sbp->sb_rblocks > 0)
                features |= XFS_FEAT_REALTIME;
+       if (sbp->sb_versionnum & XFS_SB_VERSION_NLINKBIT)
+               features |= XFS_FEAT_NLINK;
        if (sbp->sb_versionnum & XFS_SB_VERSION_ATTRBIT)
                features |= XFS_FEAT_ATTR;
        if (sbp->sb_versionnum & XFS_SB_VERSION_QUOTABIT)