]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: grab rtrmap btree when checking rgsuper
authorDarrick J. Wong <djwong@kernel.org>
Tue, 14 Jul 2026 06:05:57 +0000 (23:05 -0700)
committerCarlos Maiolino <cem@kernel.org>
Tue, 14 Jul 2026 09:01:47 +0000 (11:01 +0200)
LOLLM noticed that we aren't grabbing the rtrmap btree when we check the
realtime group superblock.  As a result, none of the cross-referencing
checks have ever run.  Fix this.

Cc: stable@vger.kernel.org # v6.14
Fixes: 428e4884656db9 ("xfs: allow queued realtime intents to drain before scrubbing")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/scrub/rgsuper.c

index 3dad6e5da74e5509defc9070c01ad92fd1fb4c12..2bd2c0351b35f738b0a590a25e77e1d3318f6b29 100644 (file)
@@ -23,6 +23,8 @@ int
 xchk_setup_rgsuperblock(
        struct xfs_scrub        *sc)
 {
+       if (xchk_need_intent_drain(sc))
+               xchk_fsgates_enable(sc, XCHK_FSGATES_DRAIN);
        return xchk_trans_alloc(sc, 0);
 }
 
@@ -43,6 +45,7 @@ xchk_rgsuperblock(
        struct xfs_scrub        *sc)
 {
        xfs_rgnumber_t          rgno = sc->sm->sm_agno;
+       unsigned int            flags;
        int                     error;
 
        /*
@@ -63,7 +66,12 @@ xchk_rgsuperblock(
        if (!xchk_xref_process_error(sc, 0, 0, &error))
                return error;
 
-       error = xchk_rtgroup_lock(sc, &sc->sr, XFS_RTGLOCK_BITMAP_SHARED);
+       if (xfs_has_rtrmapbt(sc->mp))
+               flags = XFS_RTGLOCK_BITMAP | XFS_RTGLOCK_RMAP;
+       else
+               flags = XFS_RTGLOCK_BITMAP_SHARED;
+
+       error = xchk_rtgroup_lock(sc, &sc->sr, flags);
        if (error)
                return error;