Skip to content

Commit c2a503f

Browse files
author
Kent Overstreet
committed
bcachefs: Fix bch2_bucket_gens_init()
Comparing the wrong bpos - this was missed because normally bucket_gens_init() runs on brand new filesystems, but this bug caused it to overwrite bucket_gens keys with 0s when upgrading ancient filesystems. Signed-off-by: Kent Overstreet <[email protected]>
1 parent e150a7e commit c2a503f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/bcachefs/alloc_background.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ int bch2_bucket_gens_init(struct bch_fs *c)
556556
struct bpos pos = alloc_gens_pos(iter.pos, &offset);
557557
int ret2 = 0;
558558

559-
if (have_bucket_gens_key && bkey_cmp(iter.pos, pos)) {
559+
if (have_bucket_gens_key && !bkey_eq(g.k.p, pos)) {
560560
ret2 = bch2_btree_insert_trans(trans, BTREE_ID_bucket_gens, &g.k_i, 0) ?:
561561
bch2_trans_commit(trans, NULL, NULL, BCH_TRANS_COMMIT_no_enospc);
562562
if (ret2)

0 commit comments

Comments
 (0)