summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-07-20 15:51:05 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-03-13 11:33:32 -0400
commit15394681733072c46a6d81a9bcd1d4f408fc8d8c (patch)
tree3d84f51948c51bcee44752982ad8cca1c580e11e
parentea8c7b3922de6607d442222f3fe443390c001e27 (diff)
bcachefs: Add an option for rebuilding the replicas section
There is a bug where we cnan end up clearing the data_has field in the superblock members section, which causes us to skip reading the journal and thus journal replay fails. This option tells the recovery path to not trust those fields. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r--fs/bcachefs/opts.h5
-rw-r--r--fs/bcachefs/recovery.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/fs/bcachefs/opts.h b/fs/bcachefs/opts.h
index bc274918e18c..2f93238891b0 100644
--- a/fs/bcachefs/opts.h
+++ b/fs/bcachefs/opts.h
@@ -260,6 +260,11 @@ enum opt_type {
OPT_BOOL(), \
NO_SB_OPT, false, \
NULL, "Don't replay the journal") \
+ x(rebuild_replicas, u8, \
+ OPT_MOUNT, \
+ OPT_BOOL(), \
+ NO_SB_OPT, false, \
+ NULL, "Rebuild the superblock replicas section") \
x(keep_journal, u8, \
OPT_MOUNT, \
OPT_BOOL(), \
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index 1695a609ecd9..28972f30e198 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -974,7 +974,8 @@ int bch2_fs_recovery(struct bch_fs *c)
bch_info(c, "recovering from clean shutdown, journal seq %llu",
le64_to_cpu(clean->journal_seq));
- if (!c->replicas.entries) {
+ if (!c->replicas.entries ||
+ c->opts.rebuild_replicas) {
bch_info(c, "building replicas info");
set_bit(BCH_FS_REBUILD_REPLICAS, &c->flags);
}