]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
xfs: fix frozen file system assert in xfs_trans_alloc
authorChristoph Hellwig <hch@lst.de>
Thu, 31 Jul 2025 14:19:41 +0000 (07:19 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:34:38 +0000 (16:34 +0200)
commit 647b3d59c768d7638dd17c78c8044178364383ca upstream.

Commit 83a80e95e797 ("xfs: decouple xfs_trans_alloc_empty from
xfs_trans_alloc") move the place of the assert for a frozen file system
after the sb_start_intwrite call that ensures it doesn't run on frozen
file systems, and thus allows to incorrect trigger it.

Fix that by moving it back to where it belongs.

Fixes: 83a80e95e797 ("xfs: decouple xfs_trans_alloc_empty from xfs_trans_alloc")
Reported-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/xfs_trans.c

index 1eb5071ca7def5f4cebeacba5ac9d1b5d81a14f5..f1135c4cf3c20413a96955ed1699ea815ffbaa44 100644 (file)
@@ -284,8 +284,8 @@ xfs_trans_alloc(
         * by doing GFP_KERNEL allocations inside sb_start_intwrite().
         */
 retry:
-       WARN_ON(mp->m_super->s_writers.frozen == SB_FREEZE_COMPLETE);
        tp = __xfs_trans_alloc(mp, flags);
+       WARN_ON(mp->m_super->s_writers.frozen == SB_FREEZE_COMPLETE);
        error = xfs_trans_reserve(tp, resp, blocks, rtextents);
        if (error == -ENOSPC && want_retry) {
                xfs_trans_cancel(tp);