Skip to content

Commit eef9170

Browse files
author
Kent Overstreet
committed
bcachefs: btree_node_scan: don't re-read before initializing found_btree_node
If the btree node is encrypted, this caused us to initialize found_btree_node from the encrypted header. Signed-off-by: Kent Overstreet <[email protected]>
1 parent 89edfcf commit eef9170

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

fs/bcachefs/btree_node_scan.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,6 @@ static void try_read_btree_node(struct find_btree_nodes *f, struct bch_dev *ca,
168168
if (BTREE_NODE_ID(bn) >= BTREE_ID_NR_MAX)
169169
return;
170170

171-
bio_reset(bio, ca->disk_sb.bdev, REQ_OP_READ);
172-
bio->bi_iter.bi_sector = offset;
173-
bch2_bio_map(bio, b->data, c->opts.btree_node_size);
174-
175-
submit_time = local_clock();
176-
submit_bio_wait(bio);
177-
bch2_account_io_completion(ca, BCH_MEMBER_ERROR_read, submit_time, !bio->bi_status);
178-
179171
rcu_read_lock();
180172
struct found_btree_node n = {
181173
.btree_id = BTREE_NODE_ID(bn),
@@ -192,6 +184,14 @@ static void try_read_btree_node(struct find_btree_nodes *f, struct bch_dev *ca,
192184
};
193185
rcu_read_unlock();
194186

187+
bio_reset(bio, ca->disk_sb.bdev, REQ_OP_READ);
188+
bio->bi_iter.bi_sector = offset;
189+
bch2_bio_map(bio, b->data, c->opts.btree_node_size);
190+
191+
submit_time = local_clock();
192+
submit_bio_wait(bio);
193+
bch2_account_io_completion(ca, BCH_MEMBER_ERROR_read, submit_time, !bio->bi_status);
194+
195195
found_btree_node_to_key(&b->key, &n);
196196

197197
CLASS(printbuf, buf)();

0 commit comments

Comments
 (0)