aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-08-22 11:17:04 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:25 -0400
commite14f4ab4fee5377f65e7d3bad646c1418782ead0 (patch)
tree2c4148398df5b27540c5e6496f2b5c1f468b42be /fs
parent4b0a66d508d7bfcd2dd2513d4f41a0f3a20f64d5 (diff)
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: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/btree_update_leaf.c8
-rw-r--r--fs/bcachefs/extents.c17
2 files changed, 13 insertions, 12 deletions
diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c
index 443ffb5c709d..1e631dc8ff7c 100644
--- a/fs/bcachefs/btree_update_leaf.c
+++ b/fs/bcachefs/btree_update_leaf.c
@@ -575,6 +575,10 @@ static inline int do_btree_insert_at(struct btree_trans *trans,
}
} 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);
if (race_fault()) {
@@ -875,10 +879,6 @@ int bch2_trans_commit(struct btree_trans *trans,
trans->journal_seq = journal_seq;
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) &&
!percpu_ref_tryget(&c->writes))) {
if (likely(!(trans->flags & BTREE_INSERT_LAZY_RW)))
diff --git a/fs/bcachefs/extents.c b/fs/bcachefs/extents.c
index f097bed684e5..8257a1ae384b 100644
--- a/fs/bcachefs/extents.c
+++ b/fs/bcachefs/extents.c
@@ -1373,12 +1373,11 @@ void bch2_insert_fixup_extent(struct btree_trans *trans,
if (s.deleting)
tmp.k.k.type = KEY_TYPE_discard;
-#if 0
- /* disabled due to lock recursion - mark_lock: */
+
if (debug_check_bkeys(c))
bch2_bkey_debugcheck(c, iter->l[0].b,
bkey_i_to_s_c(&tmp.k));
-#endif
+
EBUG_ON(bkey_deleted(&tmp.k.k) || !tmp.k.k.size);
extent_bset_insert(c, iter, &tmp.k);
@@ -1420,11 +1419,13 @@ void bch2_extent_debugcheck(struct bch_fs *c, struct btree *b,
* going to get overwritten during replay)
*/
- bch2_fs_bug_on(!test_bit(BCH_FS_REBUILD_REPLICAS, &c->flags) &&
- !bch2_bkey_replicas_marked(c, e.s_c, false), c,
- "extent key bad (replicas not marked in superblock):\n%s",
- (bch2_bkey_val_to_text(&PBUF(buf), c, e.s_c), buf));
-
+ if (percpu_down_read_trylock(&c->mark_lock)) {
+ bch2_fs_bug_on(!test_bit(BCH_FS_REBUILD_REPLICAS, &c->flags) &&
+ !bch2_bkey_replicas_marked_locked(c, e.s_c, false), c,
+ "extent key bad (replicas not marked in superblock):\n%s",
+ (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
* that will be overwritten by the time journal replay is done: