From: Kent Overstreet Date: Mon, 13 Feb 2023 00:24:34 +0000 (-0500) Subject: bcachefs: Fix failure to read btree roots X-Git-Tag: io_uring-6.7-2023-11-10~119^2~516 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=806c8a6aa83410cf78dc13fc63bb5df6352670f2;p=linux-block.git 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 --- 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; }