bcachefs: Run most explicit recovery passes persistent

If we detect an error that requires running a recovery pass, and we're
not in recovery, we won't be able to fix it until the next mount - make
sure we're noting in the superblock that it needs to run.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2025-04-26 12:39:17 -04:00
parent aff2b6a7fc
commit 7677859a47
6 changed files with 6 additions and 9 deletions

View File

@ -399,7 +399,7 @@ static int bucket_ref_update_err(struct btree_trans *trans, struct printbuf *buf
bool print = __bch2_count_fsck_err(c, id, buf);
int ret = bch2_run_explicit_recovery_pass_printbuf(c, buf,
int ret = bch2_run_explicit_recovery_pass_persistent(c, buf,
BCH_RECOVERY_PASS_check_allocations);
if (insert) {
@ -972,7 +972,7 @@ static int __bch2_trans_mark_metadata_bucket(struct btree_trans *trans,
bool print = bch2_count_fsck_err(c, bucket_metadata_type_mismatch, &buf);
bch2_run_explicit_recovery_pass_printbuf(c, &buf,
bch2_run_explicit_recovery_pass_persistent(c, &buf,
BCH_RECOVERY_PASS_check_allocations);
if (print)

View File

@ -104,7 +104,7 @@ int __bch2_topology_error(struct bch_fs *c, struct printbuf *out)
__bch2_inconsistent_error(c, out);
return -BCH_ERR_btree_need_topology_repair;
} else {
return bch2_run_explicit_recovery_pass_printbuf(c, out, BCH_RECOVERY_PASS_check_topology) ?:
return bch2_run_explicit_recovery_pass_persistent(c, out, BCH_RECOVERY_PASS_check_topology) ?:
-BCH_ERR_btree_node_read_validate_error;
}
}

View File

@ -162,7 +162,7 @@ static int __bch2_run_explicit_recovery_pass(struct printbuf *out,
}
}
int bch2_run_explicit_recovery_pass_printbuf(struct bch_fs *c,
static int bch2_run_explicit_recovery_pass_printbuf(struct bch_fs *c,
struct printbuf *out,
enum bch_recovery_pass pass)
{

View File

@ -8,9 +8,6 @@ u64 bch2_recovery_passes_from_stable(u64 v);
u64 bch2_fsck_recovery_passes(void);
int bch2_run_explicit_recovery_pass_printbuf(struct bch_fs *,
struct printbuf *,
enum bch_recovery_pass);
int bch2_run_explicit_recovery_pass(struct bch_fs *, enum bch_recovery_pass);
int __bch2_run_explicit_recovery_pass_persistent(struct bch_fs *, struct printbuf *,

View File

@ -20,7 +20,7 @@ int bch2_dev_missing_bkey(struct bch_fs *c, struct bkey_s_c k, unsigned dev)
bool print = bch2_count_fsck_err(c, ptr_to_invalid_device, &buf);
int ret = bch2_run_explicit_recovery_pass_printbuf(c, &buf,
int ret = bch2_run_explicit_recovery_pass_persistent(c, &buf,
BCH_RECOVERY_PASS_check_allocations);
if (print)

View File

@ -23,7 +23,7 @@ static int bch2_subvolume_missing(struct bch_fs *c, u32 subvolid)
prt_printf(&buf, "missing subvolume %u", subvolid);
bool print = bch2_count_fsck_err(c, subvol_missing, &buf);
int ret = bch2_run_explicit_recovery_pass_printbuf(c, &buf,
int ret = bch2_run_explicit_recovery_pass_persistent(c, &buf,
BCH_RECOVERY_PASS_check_inodes);
if (print)
bch2_print_str(c, KERN_ERR, buf.buf);