xfs: require a relatively recent V5 filesystem for LARP mode
PATCH 1/1 xfs: require a relatively recent V5 filesystem for LARP mode
From: Darrick J. Wong <[email protected]>
While reviewing the FIEXCHANGE code in XFS, I realized that the function that enables logged xattrs doesn't actually check that the superblock has a LOG_INCOMPAT feature bit field. Add a check to refuse the operation if we don't have a V5 filesystem...
...but on second though, let's require either reflink or rmap so that we only have to deal with LARP mode on relatively /modern/ kernel. 4.14 is about as far back as I feel like going.
Seeing as LARP is a debugging-only option anyway, this isn't likely to affect any real users.
Really-Fixes: f3f36c893f26 ("xfs: Add xfs_attr_set_deferred and xfs_attr_remove_deferred")
--- fs/xfs/xfs_xattr.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
fs/xfs/xfs_xattr.c +11 -0
@@ -46,6 +46,17 @@ xfs_attr_grab_log_assist(if (xfs_sb_version_haslogxattrs (&mp->m_sb))return 0 ; +/* +* Check if the filesystem featureset is new enough to set this log +* incompat feature bit. Strictly speaking, the minimum requirement is +* a V5 filesystem for the superblock field, but we'll require rmap +* or reflink to avoid having to deal with really old kernels. +*/ +if (!xfs_has_reflink (mp) && !xfs_has_rmapbt (mp)) { + error = -EOPNOTSUPP ; + goto drop_incompat; + } +/* Enable log-assisted xattrs. */ error =xfs_add_incompat_log_feature (mp,XFS_SB_FEAT_INCOMPAT_LOG_XATTRS );
Quoted 11 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
While reviewing the FIEXCHANGE code in XFS, I realized that the function that enables logged xattrs doesn't actually check that the superblock has a
LOG_INCOMPATfeature bit field. Add a check to refuse the operation if we don't have a V5 filesystem......but on second though, let's require either reflink or rmap so that we only have to deal with LARP mode on relatively /modern/ kernel. 4.14 is about as far back as I feel like going.
Quoted 6 lines
Seeing as LARP is a debugging-only option anyway, this isn't likely to affect any real users.
Fixes d9c61ccb3b09 ("xfs: move xfs_attr_use_log_assist out of xfs_log.c")Really-Fixes:
f3f36c893f26("xfs: Addxfs_attr_set_deferredandxfs_attr_remove_deferred")Signed-off-by Darrick J. Wong <[email protected]>
Quoted 27 lines
--- fs/xfs/xfs_xattr.c | 11 +++++++++++ 1 file changed, 11 insertions(+)fs/xfs/xfs_xattr.c +11
-0@@ -46,6 +46,17 @@ xfs_attr_grab_log_assist(if (xfs_sb_version_haslogxattrs (&mp->m_sb))return 0 ; +/* +* Check if the filesystem featureset is new enough to set this log +* incompat feature bit. Strictly speaking, the minimum requirement is +* a V5 filesystem for the superblock field, but we'll require rmap +* or reflink to avoid having to deal with really old kernels. +*/ +if (!xfs_has_reflink (mp) && !xfs_has_rmapbt (mp)) { + error = -EOPNOTSUPP ; + goto drop_incompat; + } +/* Enable log-assisted xattrs. */ error =xfs_add_incompat_log_feature (mp,XFS_SB_FEAT_INCOMPAT_LOG_XATTRS );