aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2022-05-17 22:53:22 -0400
committerEric Sandeen <sandeen@sandeen.net>2022-05-17 22:53:22 -0400
commit9f4d6358e28ba1ecbe39ef1df9b309985fa7fa0c (patch)
treed3e1b3067e3ecab1c38c7b38c4ec7f4e891395d9
parent245c72a6eeb7200e2cc3c3af4a88e5febc8e944b (diff)
downloadxfsprogs-dev-for-next.tar.gz
xfs_scrub: don't revisit scanned inodes when reprocessing a stale inodefor-next
If we decide to restart an inode chunk walk because one of the inodes is stale, make sure that we don't walk an inode that's been scanned before. This ensure we always make forward progress. Found by observing backwards inode scan progress while running xfs/285. Signed-off-by: Darrick J. Wong <djwong@kernel.org> [sandeen: add comment above forward-progress test] Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
-rw-r--r--scrub/inodes.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/scrub/inodes.c b/scrub/inodes.c
index 41e5fdc75f..ffe7eb3344 100644
--- a/scrub/inodes.c
+++ b/scrub/inodes.c
@@ -210,6 +210,7 @@ scan_ag_bulkstat(
struct scan_inodes *si = ichunk->si;
struct xfs_bulkstat *bs;
struct xfs_inumbers *inumbers = &ireq->inumbers[0];
+ uint64_t last_ino = 0;
int i;
int error;
int stale_count = 0;
@@ -229,8 +230,14 @@ retry:
/* Iterate all the inodes. */
bs = &breq->bulkstat[0];
for (i = 0; !si->aborted && i < inumbers->xi_alloccount; i++, bs++) {
+ uint64_t scan_ino = bs->bs_ino;
+
+ /* ensure forward progress if we retried */
+ if (scan_ino < last_ino)
+ continue;
+
descr_set(&dsc_bulkstat, bs);
- handle.ha_fid.fid_ino = bs->bs_ino;
+ handle.ha_fid.fid_ino = scan_ino;
handle.ha_fid.fid_gen = bs->bs_gen;
error = si->fn(ctx, &handle, bs, si->arg);
switch (error) {
@@ -260,6 +267,7 @@ _("Changed too many times during scan; giving up."));
si->aborted = true;
goto out;
}
+ last_ino = scan_ino;
}
err: