]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
xfs: require XFS_SB_FEAT_INCOMPAT_LOG_XATTRS for attr log intent item recovery
authorDarrick J. Wong <djwong@kernel.org>
Wed, 30 Apr 2025 21:26:51 +0000 (14:26 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 May 2025 07:41:37 +0000 (09:41 +0200)
[ Upstream commit 8ef1d96a985e4dc07ffbd71bd7fc5604a80cc644 ]

The XFS_SB_FEAT_INCOMPAT_LOG_XATTRS feature bit protects a filesystem
from old kernels that do not know how to recover extended attribute log
intent items.  Make this check mandatory instead of a debugging assert.

Fixes: fd920008784ea ("xfs: Set up infrastructure for log attribute replay")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/xfs_attr_item.c

index 11e88a76a33c00a99ac107fa4b1e63d534268737..c5bc6b72e0147541e39e9d33cf486ce60f464df9 100644 (file)
@@ -510,6 +510,9 @@ xfs_attri_validate(
        unsigned int                    op = attrp->alfi_op_flags &
                                             XFS_ATTRI_OP_FLAGS_TYPE_MASK;
 
+       if (!xfs_sb_version_haslogxattrs(&mp->m_sb))
+               return false;
+
        if (attrp->__pad != 0)
                return false;
 
@@ -601,8 +604,6 @@ xfs_attri_item_recover(
        args->op_flags = XFS_DA_OP_RECOVERY | XFS_DA_OP_OKNOENT |
                         XFS_DA_OP_LOGGED;
 
-       ASSERT(xfs_sb_version_haslogxattrs(&mp->m_sb));
-
        switch (attr->xattri_op_flags) {
        case XFS_ATTRI_OP_FLAGS_SET:
        case XFS_ATTRI_OP_FLAGS_REPLACE: