]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/btree_iter.c
Update bcachefs sources to 8dbfede1d9 fixup! bcachefs: More info on check_bucket_ref...
[bcachefs-tools-debian] / libbcachefs / btree_iter.c
index dc2b2a0819bd886330b6a910dcc74448c6c2b870..3977bb1fd8345bb8b9c0b970e56f15e3f9fcb853 100644 (file)
@@ -1174,10 +1174,17 @@ int bch2_btree_path_traverse_one(struct btree_trans *trans,
 
        path->uptodate = BTREE_ITER_UPTODATE;
 out:
-       if (bch2_err_matches(ret, BCH_ERR_transaction_restart) != !!trans->restarted)
-               panic("ret %s (%i) trans->restarted %s (%i)\n",
-                     bch2_err_str(ret), ret,
-                     bch2_err_str(trans->restarted), trans->restarted);
+       if (bch2_err_matches(ret, BCH_ERR_transaction_restart) != !!trans->restarted) {
+               struct printbuf buf = PRINTBUF;
+
+               prt_printf(&buf, "ret %s (%i) trans->restarted %s (%i)\n",
+                          bch2_err_str(ret), ret,
+                          bch2_err_str(trans->restarted), trans->restarted);
+#ifdef CONFIG_BCACHEFS_DEBUG
+               bch2_prt_backtrace(&buf, &trans->last_restarted);
+#endif
+               panic("%s", buf.buf);
+       }
        bch2_btree_path_verify(trans, path);
        return ret;
 }
@@ -1360,14 +1367,14 @@ void bch2_trans_restart_error(struct btree_trans *trans, u32 restart_count)
 {
        panic("trans->restart_count %u, should be %u, last restarted by %pS\n",
              trans->restart_count, restart_count,
-             (void *) trans->last_restarted_ip);
+             (void *) trans->last_begin_ip);
 }
 
 void bch2_trans_in_restart_error(struct btree_trans *trans)
 {
        panic("in transaction restart: %s, last restarted by %pS\n",
              bch2_err_str(trans->restarted),
-             (void *) trans->last_restarted_ip);
+             (void *) trans->last_begin_ip);
 }
 
 noinline __cold
@@ -2865,7 +2872,7 @@ u32 bch2_trans_begin(struct btree_trans *trans)
        if (unlikely(time_after(jiffies, trans->srcu_lock_time + msecs_to_jiffies(10))))
                bch2_trans_reset_srcu_lock(trans);
 
-       trans->last_restarted_ip = _RET_IP_;
+       trans->last_begin_ip = _RET_IP_;
        if (trans->restarted) {
                bch2_btree_path_traverse_all(trans);
                trans->notrace_relock_fail = false;
@@ -3046,6 +3053,10 @@ void bch2_trans_exit(struct btree_trans *trans)
        if (trans->paths)
                mempool_free(trans->paths, &c->btree_paths_pool);
 
+#ifdef CONFIG_BCACHEFS_DEBUG
+       darray_exit(&trans->last_restarted);
+#endif
+
        trans->mem      = (void *) 0x1;
        trans->paths    = (void *) 0x1;
 }