summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2024-04-22 19:47:41 +0300
committerDarrick J. Wong <djwong@kernel.org>2024-04-23 17:46:56 +0300
commita918f5f2cd2c9d2bf94f485c5cebbf47fb0627df (patch)
treeb5e00ab04a05289a6f7647a3863b1b764a8e8a36
parentf041455eb5773eda3291903ad6d1f33d4798e9a2 (diff)
downloadlinux-a918f5f2cd2c9d2bf94f485c5cebbf47fb0627df.tar.xz
xfs: refactor xfs_is_using_logged_xattrs checks in attr item recovery
Move this feature check down to the per-op checks so that we can ensure that we never see parent pointer attr items on non-pptr filesystems, and that logged xattrs are turned on for non-pptr attr items. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--fs/xfs/xfs_attr_item.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c
index 4a57bcff49eb..413e3d3959a5 100644
--- a/fs/xfs/xfs_attr_item.c
+++ b/fs/xfs/xfs_attr_item.c
@@ -480,9 +480,6 @@ xfs_attri_validate(
{
unsigned int op = xfs_attr_log_item_op(attrp);
- if (!xfs_is_using_logged_xattrs(mp))
- return false;
-
if (attrp->__pad != 0)
return false;
@@ -499,12 +496,16 @@ xfs_attri_validate(
switch (op) {
case XFS_ATTRI_OP_FLAGS_SET:
case XFS_ATTRI_OP_FLAGS_REPLACE:
+ if (!xfs_is_using_logged_xattrs(mp))
+ return false;
if (attrp->alfi_value_len > XATTR_SIZE_MAX)
return false;
if (!xfs_attri_validate_namelen(attrp->alfi_name_len))
return false;
break;
case XFS_ATTRI_OP_FLAGS_REMOVE:
+ if (!xfs_is_using_logged_xattrs(mp))
+ return false;
if (attrp->alfi_value_len != 0)
return false;
if (!xfs_attri_validate_namelen(attrp->alfi_name_len))