summaryrefslogtreecommitdiffstats
path: root/fs/xfs/scrub/quota.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2019-11-05 15:33:56 -0800
committerDarrick J. Wong <darrick.wong@oracle.com>2019-11-06 08:07:41 -0800
commit8ef34723eff08806e3e9c1c756c62a3cb482a3b8 (patch)
tree910a606ad3a211a09a42131cde6e63bbb883b69b /fs/xfs/scrub/quota.c
parent9842b56cd406828eb1030617e8ef252fec90be4d (diff)
downloadlinux-8ef34723eff08806e3e9c1c756c62a3cb482a3b8.tar.bz2
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>
Diffstat (limited to 'fs/xfs/scrub/quota.c')
-rw-r--r--fs/xfs/scrub/quota.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/xfs/scrub/quota.c b/fs/xfs/scrub/quota.c
index 0a33b4421c32..905a34558361 100644
--- a/fs/xfs/scrub/quota.c
+++ b/fs/xfs/scrub/quota.c
@@ -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;
}