Skip to content

Commit bef3012

Browse files
committed
Merge tag 'bcachefs-2025-07-24' of git://evilpiepirate.org/bcachefs
Pull bcachefs fixes from Kent Overstreet: "User reported fixes: - Fix btree node scan on encrypted filesystems by not using btree node header fields encrypted - Fix a race in btree write buffer flush; this caused EROs primarily during fsck for some people" * tag 'bcachefs-2025-07-24' of git://evilpiepirate.org/bcachefs: bcachefs: Add missing snapshots_seen_add_inorder() bcachefs: Fix write buffer flushing from open journal entry bcachefs: btree_node_scan: don't re-read before initializing found_btree_node
2 parents 2942242 + c37495f commit bef3012

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
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)();

fs/bcachefs/fsck.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,11 +1920,12 @@ static int check_extent(struct btree_trans *trans, struct btree_iter *iter,
19201920
"extent type past end of inode %llu:%u, i_size %llu\n%s",
19211921
i->inode.bi_inum, i->inode.bi_snapshot, i->inode.bi_size,
19221922
(bch2_bkey_val_to_text(&buf, c, k), buf.buf))) {
1923-
ret = bch2_fpunch_snapshot(trans,
1924-
SPOS(i->inode.bi_inum,
1925-
last_block,
1926-
i->inode.bi_snapshot),
1927-
POS(i->inode.bi_inum, U64_MAX));
1923+
ret = snapshots_seen_add_inorder(c, s, i->inode.bi_snapshot) ?:
1924+
bch2_fpunch_snapshot(trans,
1925+
SPOS(i->inode.bi_inum,
1926+
last_block,
1927+
i->inode.bi_snapshot),
1928+
POS(i->inode.bi_inum, U64_MAX));
19281929
if (ret)
19291930
goto err;
19301931

fs/bcachefs/journal.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,7 @@ static struct journal_buf *__bch2_next_write_buffer_flush_journal_buf(struct jou
10821082

10831083
if (open && !*blocked) {
10841084
__bch2_journal_block(j);
1085+
s.v = atomic64_read_acquire(&j->reservations.counter);
10851086
*blocked = true;
10861087
}
10871088

0 commit comments

Comments
 (0)