]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: Run most explicit recovery passes persistent
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 26 Apr 2025 16:39:17 +0000 (12:39 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 22 May 2025 00:14:37 +0000 (20:14 -0400)
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>
fs/bcachefs/buckets.c
fs/bcachefs/error.c
fs/bcachefs/recovery_passes.c
fs/bcachefs/recovery_passes.h
fs/bcachefs/sb-members.c
fs/bcachefs/subvolume.c

index 3ec33a7e9d922889b1ab706564eaa571c07acb34..596edc7bba2fbe1d7ae7a743da90692d1d94988f 100644 (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)
index 731733e12e6baa72e88d68dfe2124cec2055e583..d7bc70fd77629c34ca875cac6bb38033219b1982 100644 (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;
        }
 }
index 97af1e0629eb4b183793c6d27fde3bee0029f21f..e14aca00cb7de4f341324786d41aa1967cedf388 100644 (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)
 {
index 94fbc64e9b7ed2485fa9578b5b7ce18cf433efbf..f33dd005beb438e0f30d0358851d84407996be73 100644 (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 *,
index 462a2c21a9def6a110b87d08161ed6a6216d48d5..9ab4d9a4b4217898f7dfc4f13cdbde0d748bfba3 100644 (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)
index ff20ce98a476f72a74cb7d63c61b6d4e4ddeecb9..51ab2ee10706e9dfcad0eba562defbf6f79e36d5 100644 (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);