summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-02-24 19:04:11 -0500
committerKent Overstreet <kent.overstreet@gmail.com>2022-04-17 15:44:23 -0400
commit88ddfe4f0a4e8c141d856b60bbc848b65e3320cb (patch)
treee955dbd3776ecd2a072b25113e0e95f5cdbc0639
parent6be7c97cc212e0b3355827509e1e7ad38c78bd6c (diff)
bcachefs: Improve debug assertion
We're hitting a strange bug with transaction paths not being sorted correctly - this dumps transaction paths in the order we thought was sorted, which will hopefully shed some light as to what's going on. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r--fs/bcachefs/btree_iter.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 0f136cb51e4e..4c1c3ffe82a5 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1806,8 +1806,6 @@ void bch2_dump_trans_paths_updates(struct btree_trans *trans)
unsigned idx;
char buf1[300], buf2[300];
- btree_trans_verify_sorted(trans);
-
trans_for_each_path_inorder(trans, path, idx)
printk(KERN_ERR "path: idx %u ref %u:%u%s%s btree %s pos %s locks %u %pS\n",
path->idx, path->ref, path->intent_ref,
@@ -1873,6 +1871,7 @@ struct btree_path *bch2_path_get(struct btree_trans *trans,
int i;
BUG_ON(trans->restarted);
+ btree_trans_verify_sorted(trans);
trans_for_each_path_inorder(trans, path, i) {
if (__btree_path_cmp(path,
@@ -2733,7 +2732,10 @@ static void btree_trans_verify_sorted(struct btree_trans *trans)
unsigned i;
trans_for_each_path_inorder(trans, path, i) {
- BUG_ON(prev && btree_path_cmp(prev, path) > 0);
+ if (prev && btree_path_cmp(prev, path) > 0) {
+ bch2_dump_trans_paths_updates(trans);
+ panic("trans paths out of order!\n");
+ }
prev = path;
}
#endif