diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-04-16 18:59:54 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:54 -0400 |
commit | 006d69aa2655f1a0ca4e47666939669f27bb740f (patch) | |
tree | b286d766a03906654fb987a411defe52268f8347 /fs/bcachefs/btree_io.c | |
parent | d065472c3a7966b5104cce6901f329250f629758 (diff) | |
download | linux-stable-006d69aa2655f1a0ca4e47666939669f27bb740f.tar.gz linux-stable-006d69aa2655f1a0ca4e47666939669f27bb740f.tar.bz2 linux-stable-006d69aa2655f1a0ca4e47666939669f27bb740f.zip |
bcachefs: Don't drop ptrs to btree nodes
If a ptr gen doesn't match the bucket gen, the bucket likely doesn't
contain the data we want - but it's still possible the data we want
might have been overwritten, and for btree node pointers we can verify
whether or not the node is the one we wanted with the node's sequence
number, so it's better to keep the pointer and try reading from it.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_io.c')
-rw-r--r-- | fs/bcachefs/btree_io.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c index eac51c39fc6c..c7c91c1d5b23 100644 --- a/fs/bcachefs/btree_io.c +++ b/fs/bcachefs/btree_io.c @@ -1206,14 +1206,17 @@ void bch2_btree_node_read(struct bch_fs *c, struct btree *b, struct btree_read_bio *rb; struct bch_dev *ca; struct bio *bio; + char buf[200]; int ret; + btree_pos_to_text(&PBUF(buf), c, b); trace_btree_read(c, b); ret = bch2_bkey_pick_read_device(c, bkey_i_to_s_c(&b->key), NULL, &pick); if (bch2_fs_fatal_err_on(ret <= 0, c, - "btree node read error: no device to read from")) { + "btree node read error: no device to read from\n" + " at %s", buf)) { set_btree_node_read_error(b); return; } |