mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-01 08:04:22 +08:00
xfs: add missing early termination checks to record scrubbing functions
Scrubbing directories, quotas, and fs counters all involve iterating some collection of metadata items. The per-item scrub functions for these three are missing some of the components they need to be able to check for a fatal signal and terminate early. Per-item scrub functions need to call xchk_should_terminate to look for fatal signals, and they need to check the scrub context's corruption flag because there's no point in continuing a scan once we've decided the data structure is bad. Add both of these where missing. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
9842b56cd4
commit
8ef34723ef
@ -113,6 +113,9 @@ xchk_dir_actor(
|
||||
offset = xfs_dir2_db_to_da(mp->m_dir_geo,
|
||||
xfs_dir2_dataptr_to_db(mp->m_dir_geo, pos));
|
||||
|
||||
if (xchk_should_terminate(sdc->sc, &error))
|
||||
return error;
|
||||
|
||||
/* Does this inode number make sense? */
|
||||
if (!xfs_verify_dir_ino(mp, ino)) {
|
||||
xchk_fblock_set_corrupt(sdc->sc, XFS_DATA_FORK, offset);
|
||||
|
@ -104,7 +104,7 @@ next_loop_perag:
|
||||
pag = NULL;
|
||||
error = 0;
|
||||
|
||||
if (fatal_signal_pending(current))
|
||||
if (xchk_should_terminate(sc, &error))
|
||||
break;
|
||||
}
|
||||
|
||||
@ -163,6 +163,7 @@ xchk_fscount_aggregate_agcounts(
|
||||
uint64_t delayed;
|
||||
xfs_agnumber_t agno;
|
||||
int tries = 8;
|
||||
int error = 0;
|
||||
|
||||
retry:
|
||||
fsc->icount = 0;
|
||||
@ -196,10 +197,13 @@ retry:
|
||||
|
||||
xfs_perag_put(pag);
|
||||
|
||||
if (fatal_signal_pending(current))
|
||||
if (xchk_should_terminate(sc, &error))
|
||||
break;
|
||||
}
|
||||
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
/*
|
||||
* The global incore space reservation is taken from the incore
|
||||
* counters, so leave that out of the computation.
|
||||
|
@ -93,6 +93,10 @@ xchk_quota_item(
|
||||
unsigned long long rcount;
|
||||
xfs_ino_t fs_icount;
|
||||
xfs_dqid_t id = be32_to_cpu(d->d_id);
|
||||
int error = 0;
|
||||
|
||||
if (xchk_should_terminate(sc, &error))
|
||||
return error;
|
||||
|
||||
/*
|
||||
* Except for the root dquot, the actual dquot we got must either have
|
||||
@ -178,6 +182,9 @@ xchk_quota_item(
|
||||
if (id != 0 && rhard != 0 && rcount > rhard)
|
||||
xchk_fblock_set_warning(sc, XFS_DATA_FORK, offset);
|
||||
|
||||
if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
|
||||
return -EFSCORRUPTED;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user