]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs_scrub: check rtrmapbt metadata directory connections
authorDarrick J. Wong <djwong@kernel.org>
Tue, 9 Jan 2024 17:40:18 +0000 (09:40 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 10 Apr 2024 00:21:44 +0000 (17:21 -0700)
Run the rt rmap btree metapath scrubber during phase 5 to ensure that
it's still connected to the metadir tree after we've pruned any bad
links.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
scrub/phase5.c
scrub/scrub.h

index 3b8daf39ae61547ff634d0fb6b4062e4a98422ce..6fd3c69827047517864dc6d63adc48eb47f5b026 100644 (file)
@@ -743,6 +743,7 @@ static int
 queue_metapath_scan(
        struct workqueue        *wq,
        bool                    *abortedp,
+       xfs_rgnumber_t          rgno,
        uint64_t                type)
 {
        struct fs_scan_item     *item;
@@ -755,7 +756,7 @@ queue_metapath_scan(
                str_liberror(ctx, ret, _("setting up metapath scan"));
                return ret;
        }
-       scrub_item_init_metapath(&item->sri, type);
+       scrub_item_init_metapath(&item->sri, rgno, type);
        scrub_item_schedule(&item->sri, XFS_SCRUB_TYPE_METAPATH);
        item->abortedp = abortedp;
 
@@ -778,6 +779,7 @@ run_kernel_metadir_path_scrubbers(
        const struct xfrog_scrub_descr  *sc;
        uint64_t                type;
        unsigned int            nr_threads = scrub_nproc_workqueue(ctx);
+       xfs_rgnumber_t          rgno;
        bool                    aborted = false;
        int                     ret, ret2;
 
@@ -797,7 +799,7 @@ run_kernel_metadir_path_scrubbers(
                if (sc->group != XFROG_SCRUB_GROUP_FS)
                        continue;
 
-               ret = queue_metapath_scan(&wq, &aborted, type);
+               ret = queue_metapath_scan(&wq, &aborted, 0, type);
                if (ret) {
                        str_liberror(ctx, ret,
  _("queueing metapath scrub work"));
@@ -805,6 +807,24 @@ run_kernel_metadir_path_scrubbers(
                }
        }
 
+       /* Scan all rtgroup metadata files */
+       for (rgno = 0;
+            rgno < ctx->mnt.fsgeom.rgcount && !aborted;
+            rgno++) {
+               for (type = 0; type < XFS_SCRUB_METAPATH_NR; type++) {
+                       sc = &xfrog_metapaths[type];
+                       if (sc->group != XFROG_SCRUB_GROUP_RTGROUP)
+                               continue;
+
+                       ret = queue_metapath_scan(&wq, &aborted, rgno, type);
+                       if (ret) {
+                               str_liberror(ctx, ret,
+  _("queueing metapath scrub work"));
+                               goto wait;
+                       }
+               }
+       }
+
 wait:
        ret2 = -workqueue_terminate(&wq);
        if (ret2) {
index bb94a11dcfce71b275656425e290f84a2e8f4664..24b5ad629c5158f51eadc5c0f44440882b3aadd6 100644 (file)
@@ -118,9 +118,11 @@ scrub_item_init_file(struct scrub_item *sri, const struct xfs_bulkstat *bstat)
 }
 
 static inline void
-scrub_item_init_metapath(struct scrub_item *sri, uint64_t metapath)
+scrub_item_init_metapath(struct scrub_item *sri, xfs_rgnumber_t rgno,
+               uint64_t metapath)
 {
        memset(sri, 0, sizeof(*sri));
+       sri->sri_agno = rgno;
        sri->sri_ino = metapath;
 }