summaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorChandan Babu R <chandanbabu@kernel.org>2023-09-13 07:03:27 +0200
committerChandan Babu R <chandanbabu@kernel.org>2023-09-13 07:03:27 +0200
commit6ebb6500e54631b7013f4efe7d78ff562e437c5e (patch)
treee1d485a3543ca19bd1e8f783954e8a70eb271edd /fs/xfs
parentMerge tag 'fix-iunlink-list-6.6_2023-09-12' of https://git.kernel.org/pub/scm... (diff)
parentxfs: require a relatively recent V5 filesystem for LARP mode (diff)
downloadlinux-6ebb6500e54631b7013f4efe7d78ff562e437c5e.tar.xz
linux-6ebb6500e54631b7013f4efe7d78ff562e437c5e.zip
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
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_xattr.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
index 43e5c219aaed..a3975f325f4e 100644
--- a/fs/xfs/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c
@@ -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);