Skip to content

Commit 7857acd

Browse files
author
Chandan Babu R
committed
Merge tag 'repair-tweaks-6.6_2023-08-10' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux into xfs-6.6-mergeA
xfs: miscellaneous repair tweaks Before we start adding online repair functionality, there's a few tweaks that I'd like to make to the common repair code. First is a fix to the integration between repair and the health status code that was interfering with repair re-evaluations. Second is a minor tweak to the sole existing repair functions to make one last check that the user hasn't terminated the calling process before we start writing to the filesystem. This is a pattern that will repeat throughout the rest of the repair functions. Signed-off-by: Darrick J. Wong <[email protected]> Signed-off-by: Chandan Babu R <[email protected]> * tag 'repair-tweaks-6.6_2023-08-10' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux: xfs: allow the user to cancel repairs before we start writing xfs: always rescan allegedly healthy per-ag metadata after repair
2 parents df78332 + d728f4e commit 7857acd

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

fs/xfs/scrub/agheader_repair.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ xrep_superblock(
4949
if (error)
5050
return error;
5151

52+
/* Last chance to abort before we start committing fixes. */
53+
if (xchk_should_terminate(sc, &error))
54+
return error;
55+
5256
/* Copy AG 0's superblock to this one. */
5357
xfs_buf_zero(bp, 0, BBTOB(bp->b_length));
5458
xfs_sb_to_disk(bp->b_addr, &mp->m_sb);
@@ -424,6 +428,10 @@ xrep_agf(
424428
if (error)
425429
return error;
426430

431+
/* Last chance to abort before we start committing fixes. */
432+
if (xchk_should_terminate(sc, &error))
433+
return error;
434+
427435
/* Start rewriting the header and implant the btrees we found. */
428436
xrep_agf_init_header(sc, agf_bp, &old_agf);
429437
xrep_agf_set_roots(sc, agf, fab);
@@ -748,6 +756,10 @@ xrep_agfl(
748756
if (error)
749757
goto err;
750758

759+
/* Last chance to abort before we start committing fixes. */
760+
if (xchk_should_terminate(sc, &error))
761+
goto err;
762+
751763
/*
752764
* Update AGF and AGFL. We reset the global free block counter when
753765
* we adjust the AGF flcount (which can fail) so avoid updating any
@@ -995,6 +1007,10 @@ xrep_agi(
9951007
if (error)
9961008
return error;
9971009

1010+
/* Last chance to abort before we start committing fixes. */
1011+
if (xchk_should_terminate(sc, &error))
1012+
return error;
1013+
9981014
/* Start rewriting the header and implant the btrees we found. */
9991015
xrep_agi_init_header(sc, agi_bp, &old_agi);
10001016
xrep_agi_set_roots(sc, agi, fab);

fs/xfs/scrub/health.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,16 @@ xchk_ag_btree_healthy_enough(
226226
return true;
227227
}
228228

229+
/*
230+
* If we just repaired some AG metadata, sc->sick_mask will reflect all
231+
* the per-AG metadata types that were repaired. Exclude these from
232+
* the filesystem health query because we have not yet updated the
233+
* health status and we want everything to be scanned.
234+
*/
235+
if ((sc->flags & XREP_ALREADY_FIXED) &&
236+
type_to_health_flag[sc->sm->sm_type].group == XHG_AG)
237+
mask &= ~sc->sick_mask;
238+
229239
if (xfs_ag_has_sickness(pag, mask)) {
230240
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XFAIL;
231241
return false;

0 commit comments

Comments
 (0)