Skip to content

Commit 3438961

Browse files
author
Darrick J. Wong
committed
xfs: require a relatively recent V5 filesystem for LARP mode
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. Fixes: d9c61cc ("xfs: move xfs_attr_use_log_assist out of xfs_log.c") Really-Fixes: f3f36c8 ("xfs: Add xfs_attr_set_deferred and xfs_attr_remove_deferred") Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Bill O'Donnell <bodonnel@redhat.com>
1 parent 49813a2 commit 3438961

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

fs/xfs/xfs_xattr.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ xfs_attr_grab_log_assist(
4646
if (xfs_sb_version_haslogxattrs(&mp->m_sb))
4747
return 0;
4848

49+
/*
50+
* Check if the filesystem featureset is new enough to set this log
51+
* incompat feature bit. Strictly speaking, the minimum requirement is
52+
* a V5 filesystem for the superblock field, but we'll require rmap
53+
* or reflink to avoid having to deal with really old kernels.
54+
*/
55+
if (!xfs_has_reflink(mp) && !xfs_has_rmapbt(mp)) {
56+
error = -EOPNOTSUPP;
57+
goto drop_incompat;
58+
}
59+
4960
/* Enable log-assisted xattrs. */
5061
error = xfs_add_incompat_log_feature(mp,
5162
XFS_SB_FEAT_INCOMPAT_LOG_XATTRS);

0 commit comments

Comments
 (0)