From: Darrick J. Wong Date: Tue, 30 Jun 2026 01:02:39 +0000 (-0700) Subject: xfs_scrub: fix estimate of work items for phase 4 X-Git-Tag: v7.1.0~18 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=70d0a4f274641f9987a260d5d2aa04d10e274787;p=xfsprogs-dev.git xfs_scrub: fix estimate of work items for phase 4 Codex complains that the number of work items computed when estimating the amount of work for phase 4 doesn't include the FSCOUNTERS and QUOTACHECK items. Add them back in. Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- diff --git a/scrub/phase4.c b/scrub/phase4.c index 6bd16c23..95fb42f1 100644 --- a/scrub/phase4.c +++ b/scrub/phase4.c @@ -254,7 +254,8 @@ phase4_func( * phase 7, but some of the cross-referencing requires fairly accurate * summary counters. Check and try to repair them now to minimize the * chance that repairs of primary metadata fail due to secondary - * metadata. If repairs fails, we'll come back during phase 7. + * metadata or ENOSPC on broken counters. If repairs fails, we'll come + * back during phase 7. */ scrub_item_init_fs(&sri); scrub_item_schedule(&sri, XFS_SCRUB_TYPE_FSCOUNTERS); @@ -269,6 +270,10 @@ phase4_func( if (ret) return ret; + /* + * Try to fix the quota usage counts so that online repair doesn't + * fail with EDQUOT (or worse shut down the fs) due to bad counts. + */ if (fsgeom.sick & XFS_FSOP_GEOM_SICK_QUOTACHECK) scrub_item_schedule(&sri, XFS_SCRUB_TYPE_QUOTACHECK); @@ -293,10 +298,18 @@ phase4_estimate( { unsigned long long need_fixing; - /* Everything on the repair lis. */ + /* Everything on the repair lists. */ need_fixing = action_list_length(ctx->fs_repair_list) + action_list_length(ctx->file_repair_list); + /* + * fscounters and quotacheck are run directly by phase4_func + * independent of the repair lists, so put that in the item count. + * See phase4_func for why. + */ + if (need_fixing) + need_fixing += 2; + *items = need_fixing; *nr_threads = scrub_nproc(ctx) + 1; *rshift = 0;