Skip to content

Commit 6ebb650

Browse files
author
Chandan Babu R
committed
Merge tag 'fix-larp-requirements-6.6_2023-09-12' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux into xfs-6.6-fixesA
xfs: disallow LARP on old fses Before enabling logged xattrs, make sure the filesystem is new enough that it actually supports log incompat features. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org> * tag 'fix-larp-requirements-6.6_2023-09-12' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux: xfs: require a relatively recent V5 filesystem for LARP mode
2 parents abf7c81 + 3438961 commit 6ebb650

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)