summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-02-12 19:24:34 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-03-13 11:34:49 -0400
commit8e6a3ea49f56b252026d90e3325d5d01959c2dc8 (patch)
tree654411cefbbccc034fb4ec2667422288d43085fa
parentc80018dbac3401d89816d761dd61670825b5042f (diff)
bcachefs: Fix failure to read btree roots
If failed to read a btree root - or if we're not using a btree root, because of the reconstruct_alloc option - make sure we update the corresponding info for the key/level for the root on disk. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/recovery.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index 8a78377bf9c5..178f06424460 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -974,9 +974,15 @@ static int read_btree_roots(struct bch_fs *c)
}
}
- for (i = 0; i < BTREE_ID_NR; i++)
- if (!c->btree_roots[i].b)
+ for (i = 0; i < BTREE_ID_NR; i++) {
+ struct btree_root *r = &c->btree_roots[i];
+
+ if (!r->b) {
+ r->alive = false;
+ r->level = 0;
bch2_btree_root_alloc(c, i);
+ }
+ }
fsck_err:
return ret;
}