diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-04-23 16:18:43 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:01 -0400 |
commit | 1c8441bea5366ec1e4f077ab675b49a603d7cad8 (patch) | |
tree | d5728ca0923336de7a072bc7b5762e70d30c75b2 /fs/bcachefs/btree_gc.c | |
parent | 58686a259ed28f1ee50cc0aaa039e986aa218e0c (diff) | |
download | lwn-1c8441bea5366ec1e4f077ab675b49a603d7cad8.tar.gz lwn-1c8441bea5366ec1e4f077ab675b49a603d7cad8.zip |
bcachefs: Fix repair leading to replicas not marked
bch2_check_fix_ptrs() was being called after checking if the replicas
set was marked - but repair could change which replicas set needed to be
marked. Oops.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_gc.c')
-rw-r--r-- | fs/bcachefs/btree_gc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/bcachefs/btree_gc.c b/fs/bcachefs/btree_gc.c index a7ffd566d431..6983a1197905 100644 --- a/fs/bcachefs/btree_gc.c +++ b/fs/bcachefs/btree_gc.c @@ -330,6 +330,10 @@ static int bch2_gc_mark_key(struct bch_fs *c, enum btree_id btree_id, BUG_ON(bch2_journal_seq_verify && k->k->version.lo > journal_cur_seq(&c->journal)); + ret = bch2_check_fix_ptrs(c, btree_id, level, is_root, k); + if (ret) + goto err; + if (fsck_err_on(k->k->version.lo > atomic64_read(&c->key_version), c, "key version number higher than recorded: %llu > %llu", k->k->version.lo, @@ -346,8 +350,6 @@ static int bch2_gc_mark_key(struct bch_fs *c, enum btree_id btree_id, goto err; } } - - ret = bch2_check_fix_ptrs(c, btree_id, level, is_root, k); } ptrs = bch2_bkey_ptrs_c(*k); |