bcachefs: Don't rewind to run a recovery pass we already ran
authorKent Overstreet <kent.overstreet@linux.dev>
Mon, 26 May 2025 15:12:53 +0000 (11:12 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Tue, 27 May 2025 04:03:45 +0000 (00:03 -0400)
Fix a small regression from the "run recovery passes" rewrite, which
enabled async recovery passes.

This fixes getting stuck in a loop in recovery.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/recovery_passes.c

index dabb29b..212658c 100644 (file)
@@ -315,7 +315,9 @@ int __bch2_run_explicit_recovery_pass(struct bch_fs *c,
                goto out;
 
        bool in_recovery = test_bit(BCH_FS_in_recovery, &c->flags);
-       bool rewind = in_recovery && r->curr_pass > pass;
+       bool rewind = in_recovery &&
+               r->curr_pass > pass &&
+               !(r->passes_complete & BIT_ULL(pass));
        bool ratelimit = flags & RUN_RECOVERY_PASS_ratelimit;
 
        if (!(in_recovery && (flags & RUN_RECOVERY_PASS_nopersistent))) {