diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-06-06 22:09:11 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2022-06-07 00:27:23 -0400 |
commit | c68fda3e8f4106f1e1881e650f702d5bc2d301cb (patch) | |
tree | 16fe7048a79defbe2b30fc178511f6d7b2c1fc56 | |
parent | cbc3a12a16cd974d402ae0493d785b2416c3f4dd (diff) |
bcachefs: Fix btree node read error path
We were forgetting to clear the read_in_flight flag - oops. This also
fixes it to not call bch2_fatal_error() before topology repair has had a
chance to do its thing.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r-- | fs/bcachefs/btree_io.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c index 4629617bfa0e..a04d48aecd14 100644 --- a/fs/bcachefs/btree_io.c +++ b/fs/bcachefs/btree_io.c @@ -1488,23 +1488,32 @@ void bch2_btree_node_read(struct bch_fs *c, struct btree *b, struct btree_read_bio *rb; struct bch_dev *ca; struct bio *bio; - struct printbuf buf = PRINTBUF; int ret; - btree_pos_to_text(&buf, c, b); trace_btree_read(c, b); if (bch2_verify_all_btree_replicas && !btree_node_read_all_replicas(c, b, sync)) - goto out; + return; 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\n" - " at %s", buf.buf)) { + + if (ret <= 0) { + struct printbuf buf = PRINTBUF; + + pr_buf(&buf, "btree node read error: no device to read from\n at "); + btree_pos_to_text(&buf, c, b); + bch_err(c, "%s", buf.buf); + + if (test_bit(BCH_FS_TOPOLOGY_REPAIR_DONE, &c->flags)) + bch2_fatal_error(c); + set_btree_node_read_error(b); - goto out; + clear_btree_node_read_in_flight(b); + wake_up_bit(&b->flags, BTREE_NODE_read_in_flight); + printbuf_exit(&buf); + return; } ca = bch_dev_bkey_exists(c, pick.ptr.dev); @@ -1546,8 +1555,6 @@ void bch2_btree_node_read(struct bch_fs *c, struct btree *b, else queue_work(c->io_complete_wq, &rb->work); } -out: - printbuf_exit(&buf); } int bch2_btree_root_read(struct bch_fs *c, enum btree_id id, |