Skip to content

Commit 2d5f38a

Browse files
Darrick J. WongDave Chinner
authored andcommitted
xfs: disable reaping in fscounters scrub
The fscounters scrub code doesn't work properly because it cannot quiesce updates to the percpu counters in the filesystem, hence it returns false corruption reports. This has been fixed properly in one of the online repair patchsets that are under review by replacing the xchk_disable_reaping calls with an exclusive filesystem freeze. Disabling background gc isn't sufficient to fix the problem. In other words, scrub doesn't need to call xfs_inodegc_stop, which is just as well since it wasn't correct to allow scrub to call xfs_inodegc_start when something else could be calling xfs_inodegc_stop (e.g. trying to freeze the filesystem). Neuter the scrubber for now, and remove the xchk_*_reaping functions. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Dave Chinner <[email protected]> Signed-off-by: Dave Chinner <[email protected]>
1 parent b37c4c8 commit 2d5f38a

File tree

6 files changed

+6
-39
lines changed

6 files changed

+6
-39
lines changed

fs/xfs/scrub/common.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,32 +1164,6 @@ xchk_metadata_inode_forks(
11641164
return 0;
11651165
}
11661166

1167-
/* Pause background reaping of resources. */
1168-
void
1169-
xchk_stop_reaping(
1170-
struct xfs_scrub *sc)
1171-
{
1172-
sc->flags |= XCHK_REAPING_DISABLED;
1173-
xfs_blockgc_stop(sc->mp);
1174-
xfs_inodegc_stop(sc->mp);
1175-
}
1176-
1177-
/* Restart background reaping of resources. */
1178-
void
1179-
xchk_start_reaping(
1180-
struct xfs_scrub *sc)
1181-
{
1182-
/*
1183-
* Readonly filesystems do not perform inactivation or speculative
1184-
* preallocation, so there's no need to restart the workers.
1185-
*/
1186-
if (!xfs_is_readonly(sc->mp)) {
1187-
xfs_inodegc_start(sc->mp);
1188-
xfs_blockgc_start(sc->mp);
1189-
}
1190-
sc->flags &= ~XCHK_REAPING_DISABLED;
1191-
}
1192-
11931167
/*
11941168
* Enable filesystem hooks (i.e. runtime code patching) before starting a scrub
11951169
* operation. Callers must not hold any locks that intersect with the CPU

fs/xfs/scrub/common.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ static inline bool xchk_skip_xref(struct xfs_scrub_metadata *sm)
156156
}
157157

158158
int xchk_metadata_inode_forks(struct xfs_scrub *sc);
159-
void xchk_stop_reaping(struct xfs_scrub *sc);
160-
void xchk_start_reaping(struct xfs_scrub *sc);
161159

162160
/*
163161
* Setting up a hook to wait for intents to drain is costly -- we have to take

fs/xfs/scrub/fscounters.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,6 @@ xchk_setup_fscounters(
150150
if (error)
151151
return error;
152152

153-
/*
154-
* Pause background reclaim while we're scrubbing to reduce the
155-
* likelihood of background perturbations to the counters throwing off
156-
* our calculations.
157-
*/
158-
xchk_stop_reaping(sc);
159-
160153
return xchk_trans_alloc(sc, 0);
161154
}
162155

@@ -453,6 +446,12 @@ xchk_fscounters(
453446
if (frextents > mp->m_sb.sb_rextents)
454447
xchk_set_corrupt(sc);
455448

449+
/*
450+
* XXX: We can't quiesce percpu counter updates, so exit early.
451+
* This can be re-enabled when we gain exclusive freeze functionality.
452+
*/
453+
return 0;
454+
456455
/*
457456
* If ifree exceeds icount by more than the minimum variance then
458457
* something's probably wrong with the counters.

fs/xfs/scrub/scrub.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,6 @@ xchk_teardown(
186186
}
187187
if (sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR)
188188
mnt_drop_write_file(sc->file);
189-
if (sc->flags & XCHK_REAPING_DISABLED)
190-
xchk_start_reaping(sc);
191189
if (sc->buf) {
192190
if (sc->buf_cleanup)
193191
sc->buf_cleanup(sc->buf);

fs/xfs/scrub/scrub.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ struct xfs_scrub {
106106

107107
/* XCHK state flags grow up from zero, XREP state flags grown down from 2^31 */
108108
#define XCHK_TRY_HARDER (1 << 0) /* can't get resources, try again */
109-
#define XCHK_REAPING_DISABLED (1 << 1) /* background block reaping paused */
110109
#define XCHK_FSGATES_DRAIN (1 << 2) /* defer ops draining enabled */
111110
#define XCHK_NEED_DRAIN (1 << 3) /* scrub needs to drain defer ops */
112111
#define XREP_ALREADY_FIXED (1 << 31) /* checking our repair work */

fs/xfs/scrub/trace.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_FSCOUNTERS);
9898

9999
#define XFS_SCRUB_STATE_STRINGS \
100100
{ XCHK_TRY_HARDER, "try_harder" }, \
101-
{ XCHK_REAPING_DISABLED, "reaping_disabled" }, \
102101
{ XCHK_FSGATES_DRAIN, "fsgates_drain" }, \
103102
{ XCHK_NEED_DRAIN, "need_drain" }, \
104103
{ XREP_ALREADY_FIXED, "already_fixed" }

0 commit comments

Comments
 (0)