Commit e14f4ab4 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Re-enable bkey_debugcheck() in the extent update path

Also, move other update path checks to where they actually check all the
updates (after triggers have run)
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 4b0a66d5
...@@ -575,6 +575,10 @@ static inline int do_btree_insert_at(struct btree_trans *trans, ...@@ -575,6 +575,10 @@ static inline int do_btree_insert_at(struct btree_trans *trans,
} }
} while (saw_non_marked); } while (saw_non_marked);
trans_for_each_update(trans, i)
btree_insert_entry_checks(trans, i);
bch2_btree_trans_verify_locks(trans);
btree_trans_lock_write(c, trans); btree_trans_lock_write(c, trans);
if (race_fault()) { if (race_fault()) {
...@@ -875,10 +879,6 @@ int bch2_trans_commit(struct btree_trans *trans, ...@@ -875,10 +879,6 @@ int bch2_trans_commit(struct btree_trans *trans,
trans->journal_seq = journal_seq; trans->journal_seq = journal_seq;
trans->flags = flags; trans->flags = flags;
trans_for_each_update(trans, i)
btree_insert_entry_checks(trans, i);
bch2_btree_trans_verify_locks(trans);
if (unlikely(!(trans->flags & BTREE_INSERT_NOCHECK_RW) && if (unlikely(!(trans->flags & BTREE_INSERT_NOCHECK_RW) &&
!percpu_ref_tryget(&c->writes))) { !percpu_ref_tryget(&c->writes))) {
if (likely(!(trans->flags & BTREE_INSERT_LAZY_RW))) if (likely(!(trans->flags & BTREE_INSERT_LAZY_RW)))
......
...@@ -1373,12 +1373,11 @@ void bch2_insert_fixup_extent(struct btree_trans *trans, ...@@ -1373,12 +1373,11 @@ void bch2_insert_fixup_extent(struct btree_trans *trans,
if (s.deleting) if (s.deleting)
tmp.k.k.type = KEY_TYPE_discard; tmp.k.k.type = KEY_TYPE_discard;
#if 0
/* disabled due to lock recursion - mark_lock: */
if (debug_check_bkeys(c)) if (debug_check_bkeys(c))
bch2_bkey_debugcheck(c, iter->l[0].b, bch2_bkey_debugcheck(c, iter->l[0].b,
bkey_i_to_s_c(&tmp.k)); bkey_i_to_s_c(&tmp.k));
#endif
EBUG_ON(bkey_deleted(&tmp.k.k) || !tmp.k.k.size); EBUG_ON(bkey_deleted(&tmp.k.k) || !tmp.k.k.size);
extent_bset_insert(c, iter, &tmp.k); extent_bset_insert(c, iter, &tmp.k);
...@@ -1420,11 +1419,13 @@ void bch2_extent_debugcheck(struct bch_fs *c, struct btree *b, ...@@ -1420,11 +1419,13 @@ void bch2_extent_debugcheck(struct bch_fs *c, struct btree *b,
* going to get overwritten during replay) * going to get overwritten during replay)
*/ */
if (percpu_down_read_trylock(&c->mark_lock)) {
bch2_fs_bug_on(!test_bit(BCH_FS_REBUILD_REPLICAS, &c->flags) && bch2_fs_bug_on(!test_bit(BCH_FS_REBUILD_REPLICAS, &c->flags) &&
!bch2_bkey_replicas_marked(c, e.s_c, false), c, !bch2_bkey_replicas_marked_locked(c, e.s_c, false), c,
"extent key bad (replicas not marked in superblock):\n%s", "extent key bad (replicas not marked in superblock):\n%s",
(bch2_bkey_val_to_text(&PBUF(buf), c, e.s_c), buf)); (bch2_bkey_val_to_text(&PBUF(buf), c, e.s_c), buf));
percpu_up_read(&c->mark_lock);
}
/* /*
* If journal replay hasn't finished, we might be seeing keys * If journal replay hasn't finished, we might be seeing keys
* that will be overwritten by the time journal replay is done: * that will be overwritten by the time journal replay is done:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment