summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2022-05-20 09:06:08 -0700
committerDarrick J. Wong <djwong@kernel.org>2022-05-23 17:55:58 -0700
commit3a8857bbbdac6f3c45f031907aa34978ec1cd409 (patch)
tree11c6ab6cd51032792a726f1b78fdf558a70b163d
parentb3aef250a509da8d423e981fb126ec9f8b2b704e (diff)
xfs: do not use logged xattr updates on V4 filesystems
V4 superblocks do not contain the log_incompat feature bit, which means that we cannot protect xattr log items against kernels that are too old to know how to recover them. Turn off the log items for such filesystems and adjust the "delayed" name to reflect what it's really controlling. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
-rw-r--r--fs/xfs/libxfs/xfs_attr.c6
-rw-r--r--fs/xfs/libxfs/xfs_attr.h3
2 files changed, 5 insertions, 4 deletions
diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index 79615727f8c2..9f14aca29ec4 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -982,7 +982,7 @@ xfs_attr_set(
int error, local;
int rmt_blks = 0;
unsigned int total;
- int delayed = xfs_has_larp(mp);
+ bool use_logging = xfs_has_larp(mp);
if (xfs_is_shutdown(dp->i_mount))
return -EIO;
@@ -1027,7 +1027,7 @@ xfs_attr_set(
rmt_blks = xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX);
}
- if (delayed) {
+ if (use_logging) {
error = xfs_attr_use_log_assist(mp);
if (error)
return error;
@@ -1101,7 +1101,7 @@ xfs_attr_set(
out_unlock:
xfs_iunlock(dp, XFS_ILOCK_EXCL);
drop_incompat:
- if (delayed)
+ if (use_logging)
xlog_drop_incompat_feat(mp->m_log);
return error;
diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h
index b88b6d74e4fc..3cd9cbb68b0f 100644
--- a/fs/xfs/libxfs/xfs_attr.h
+++ b/fs/xfs/libxfs/xfs_attr.h
@@ -31,7 +31,8 @@ struct xfs_attr_list_context;
static inline bool xfs_has_larp(struct xfs_mount *mp)
{
#ifdef DEBUG
- return xfs_globals.larp;
+ /* Logged xattrs require a V5 super for log_incompat */
+ return xfs_has_crc(mp) && xfs_globals.larp;
#else
return false;
#endif