]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
xfs: don't assert fail on perag references on teardown
authorDave Chinner <dchinner@redhat.com>
Sat, 18 Mar 2023 10:15:15 +0000 (12:15 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Mar 2023 12:30:06 +0000 (13:30 +0100)
commit 5b55cbc2d72632e874e50d2e36bce608e55aaaea upstream.

[backport for 5.10.y, prior to perag refactoring in v5.14]

Not fatal, the assert is there to catch developer attention. I'm
seeing this occasionally during recoveryloop testing after a
shutdown, and I don't want this to stop an overnight recoveryloop
run as it is currently doing.

Convert the ASSERT to a XFS_IS_CORRUPT() check so it will dump a
corruption report into the log and cause a test failure that way,
but it won't stop the machine dead.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/xfs_mount.c

index a2a5a0fd923341b7601a59d2c2a52eeb72defcb3..402cf828cc919a6759db4179e702d7aacdb947d7 100644 (file)
@@ -126,7 +126,6 @@ __xfs_free_perag(
 {
        struct xfs_perag *pag = container_of(head, struct xfs_perag, rcu_head);
 
-       ASSERT(atomic_read(&pag->pag_ref) == 0);
        kmem_free(pag);
 }
 
@@ -145,7 +144,7 @@ xfs_free_perag(
                pag = radix_tree_delete(&mp->m_perag_tree, agno);
                spin_unlock(&mp->m_perag_lock);
                ASSERT(pag);
-               ASSERT(atomic_read(&pag->pag_ref) == 0);
+               XFS_IS_CORRUPT(pag->pag_mount, atomic_read(&pag->pag_ref) != 0);
                xfs_iunlink_destroy(pag);
                xfs_buf_hash_destroy(pag);
                call_rcu(&pag->rcu_head, __xfs_free_perag);