diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-03-08 19:57:22 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-03-10 15:18:13 -0400 |
commit | ba89083e9f5d9d26f64565ec3ecb823b5bcad055 (patch) | |
tree | a4c52dd758da7c240112406eb9673d862151bcc0 /fs/bcachefs/btree_iter.c | |
parent | 52f3a72fa7f4f021398d17e4ffa760d0b2a46386 (diff) | |
download | lwn-ba89083e9f5d9d26f64565ec3ecb823b5bcad055.tar.gz lwn-ba89083e9f5d9d26f64565ec3ecb823b5bcad055.zip |
bcachefs: Fix journal replay with unreadable btree roots
When a btree root is unreadable, we still might be able to get some data
back by replaying what's in the journal. Previously though, we got
confused when journal replay would attempt to replay a key for a level
that didn't exist.
This adds bch2_btree_increase_depth(), so that journal replay can handle
this.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_iter.c')
-rw-r--r-- | fs/bcachefs/btree_iter.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c index 3ef338df82f5..cab2e3fa900b 100644 --- a/fs/bcachefs/btree_iter.c +++ b/fs/bcachefs/btree_iter.c @@ -1729,7 +1729,9 @@ bch2_btree_iter_traverse(struct btree_iter *iter) if (ret) return ret; - btree_path_set_should_be_locked(trans->paths + iter->path); + struct btree_path *path = btree_iter_path(trans, iter); + if (btree_path_node(path, path->level)) + btree_path_set_should_be_locked(path); return 0; } |