diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-02-12 19:24:34 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:52 -0400 |
commit | 806c8a6aa83410cf78dc13fc63bb5df6352670f2 (patch) | |
tree | 579b838a17253ef1aeb92098c9be7c2d11ae12ec /fs/bcachefs/recovery.c | |
parent | 3277081522d8620f7410b173881d4b0267ce58f9 (diff) | |
download | linux-stable-806c8a6aa83410cf78dc13fc63bb5df6352670f2.tar.gz linux-stable-806c8a6aa83410cf78dc13fc63bb5df6352670f2.tar.bz2 linux-stable-806c8a6aa83410cf78dc13fc63bb5df6352670f2.zip |
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>
Diffstat (limited to 'fs/bcachefs/recovery.c')
-rw-r--r-- | fs/bcachefs/recovery.c | 10 |
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; } |