bcachefs: Sync journal when we complete a recovery pass
authorKent Overstreet <kent.overstreet@linux.dev>
Wed, 17 Apr 2024 06:03:22 +0000 (02:03 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Wed, 8 May 2024 21:29:20 +0000 (17:29 -0400)
Make things easier when we're debugging long fsck runs - persist the
work that successful recovery passes did.

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

index c065c0d012125740596c5e35c665595b0bea2c2b..4a9eb9582b6e526a0f10b73c53d26b7868b50326 100644 (file)
@@ -222,7 +222,8 @@ int bch2_run_recovery_passes(struct bch_fs *c)
                if (should_run_recovery_pass(c, c->curr_recovery_pass)) {
                        unsigned pass = c->curr_recovery_pass;
 
-                       ret = bch2_run_recovery_pass(c, c->curr_recovery_pass);
+                       ret =   bch2_run_recovery_pass(c, c->curr_recovery_pass) ?:
+                               bch2_journal_flush(&c->journal);
                        if (bch2_err_matches(ret, BCH_ERR_restart_recovery) ||
                            (ret && c->curr_recovery_pass < pass))
                                continue;