bcachefs: Ensure topology repair runs

This fixes should_restart_for_topology_repair() - previously it was
returning false if the btree io path had already seleceted topology
repair to run, even if it hadn't run yet.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2023-08-03 20:57:06 -04:00
parent ad52bac251
commit 0ed4ca146e
4 changed files with 5 additions and 1 deletions

View File

@ -995,6 +995,7 @@ struct bch_fs {
enum bch_recovery_pass curr_recovery_pass;
/* bitmap of explicitly enabled recovery passes: */
u64 recovery_passes_explicit;
u64 recovery_passes_complete;
/* DEBUG JUNK */
struct dentry *fs_debug_dir;

View File

@ -43,7 +43,7 @@
static bool should_restart_for_topology_repair(struct bch_fs *c)
{
return c->opts.fix_errors != FSCK_FIX_no &&
!(c->recovery_passes_explicit & BIT_ULL(BCH_RECOVERY_PASS_check_topology));
!(c->recovery_passes_complete & BIT_ULL(BCH_RECOVERY_PASS_check_topology));
}
static inline void __gc_pos_set(struct bch_fs *c, struct gc_pos new_pos)

View File

@ -1266,6 +1266,8 @@ static int bch2_run_recovery_pass(struct bch_fs *c, enum bch_recovery_pass pass)
return ret;
if (!(p->when & PASS_SILENT))
printk(KERN_CONT " done\n");
c->recovery_passes_complete |= BIT_ULL(pass);
}
return 0;

View File

@ -68,6 +68,7 @@ static inline int bch2_run_explicit_recovery_pass(struct bch_fs *c,
if (c->curr_recovery_pass >= pass) {
c->curr_recovery_pass = pass;
c->recovery_passes_complete &= (1ULL << pass) >> 1;
return -BCH_ERR_restart_recovery;
} else {
return 0;