summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-04-26 12:39:17 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2025-05-21 20:14:37 -0400
commit7677859a47a464f1c5603077809d4bc13f2d549f (patch)
tree707bc5c40744d83738cab21722456b95cb34734c
parentbcachefs: provide unlocked version of run_explicit_recovery_pass_persistent (diff)
downloadlinux-7677859a47a464f1c5603077809d4bc13f2d549f.tar.gz
linux-7677859a47a464f1c5603077809d4bc13f2d549f.zip
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>
-rw-r--r--fs/bcachefs/buckets.c4
-rw-r--r--fs/bcachefs/error.c2
-rw-r--r--fs/bcachefs/recovery_passes.c2
-rw-r--r--fs/bcachefs/recovery_passes.h3
-rw-r--r--fs/bcachefs/sb-members.c2
-rw-r--r--fs/bcachefs/subvolume.c2
6 files changed, 6 insertions, 9 deletions
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c
index 3ec33a7e9d92..596edc7bba2f 100644
--- a/fs/bcachefs/buckets.c
+++ b/fs/bcachefs/buckets.c
@@ -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)
diff --git a/fs/bcachefs/error.c b/fs/bcachefs/error.c
index 731733e12e6b..d7bc70fd7762 100644
--- a/fs/bcachefs/error.c
+++ b/fs/bcachefs/error.c
@@ -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;
}
}
diff --git a/fs/bcachefs/recovery_passes.c b/fs/bcachefs/recovery_passes.c
index 97af1e0629eb..e14aca00cb7d 100644
--- a/fs/bcachefs/recovery_passes.c
+++ b/fs/bcachefs/recovery_passes.c
@@ -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)
{
diff --git a/fs/bcachefs/recovery_passes.h b/fs/bcachefs/recovery_passes.h
index 94fbc64e9b7e..f33dd005beb4 100644
--- a/fs/bcachefs/recovery_passes.h
+++ b/fs/bcachefs/recovery_passes.h
@@ -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 *,
diff --git a/fs/bcachefs/sb-members.c b/fs/bcachefs/sb-members.c
index 462a2c21a9de..9ab4d9a4b421 100644
--- a/fs/bcachefs/sb-members.c
+++ b/fs/bcachefs/sb-members.c
@@ -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)
diff --git a/fs/bcachefs/subvolume.c b/fs/bcachefs/subvolume.c
index ff20ce98a476..51ab2ee10706 100644
--- a/fs/bcachefs/subvolume.c
+++ b/fs/bcachefs/subvolume.c
@@ -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);