{
        unsigned level = path->level;
 
-       EBUG_ON(trans->restarted);
+       bch2_trans_verify_not_in_restart(trans);
        EBUG_ON(!path->ref);
 
        path = bch2_btree_path_make_mut(trans, path, intent, ip);
        __bch2_path_free(trans, path);
 }
 
+void __noreturn 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 __noreturn 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);
+}
+
 noinline __cold
 void bch2_trans_updates_to_text(struct printbuf *buf, struct btree_trans *trans)
 {
        bool intent = flags & BTREE_ITER_INTENT;
        int i;
 
-       EBUG_ON(trans->restarted);
+       bch2_trans_verify_not_in_restart(trans);
        bch2_trans_verify_locks(trans);
 
        btree_trans_sort_paths(trans);
        struct btree *b = NULL;
        int ret;
 
-       BUG_ON(trans->restarted);
+       bch2_trans_verify_not_in_restart(trans);
        EBUG_ON(iter->path->cached);
        bch2_btree_iter_verify(iter);
 
        return trans->restart_count;
 }
 
-void bch2_trans_verify_not_restarted(struct btree_trans *trans, u32 restart_count)
-{
-       if (trans_was_restarted(trans, 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);
-}
-
 static void bch2_trans_alloc_paths(struct btree_trans *trans, struct bch_fs *c)
 {
        size_t paths_bytes      = sizeof(struct btree_path) * BTREE_ITER_MAX;
 
        return restart_count != trans->restart_count;
 }
 
-void bch2_trans_verify_not_restarted(struct btree_trans *, u32);
+void __noreturn bch2_trans_restart_error(struct btree_trans *, u32);
+
+static inline void bch2_trans_verify_not_restarted(struct btree_trans *trans,
+                                                  u32 restart_count)
+{
+       if (trans_was_restarted(trans, restart_count))
+               bch2_trans_restart_error(trans, restart_count);
+}
+
+void __noreturn bch2_trans_in_restart_error(struct btree_trans *);
+
+static inline void bch2_trans_verify_not_in_restart(struct btree_trans *trans)
+{
+       if (trans->restarted)
+               bch2_trans_in_restart_error(trans);
+}
 
 __always_inline
 static inline int btree_trans_restart_nounlock(struct btree_trans *trans, int err)