diff options
Diffstat (limited to 'libbcachefs/btree_iter.c')
-rw-r--r-- | libbcachefs/btree_iter.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libbcachefs/btree_iter.c b/libbcachefs/btree_iter.c index e11270e0..0444dbd1 100644 --- a/libbcachefs/btree_iter.c +++ b/libbcachefs/btree_iter.c @@ -486,6 +486,8 @@ void bch2_trans_unlock(struct btree_trans *trans) trans_for_each_iter(trans, iter) __bch2_btree_iter_unlock(iter); + + BUG_ON(lock_class_is_held(&bch2_btree_node_lock_key)); } /* Btree iterator: */ @@ -2293,6 +2295,22 @@ inline void bch2_trans_unlink_iters(struct btree_trans *trans) } } +/** + * bch2_trans_reset() - reset a transaction after a interrupted attempt + * @trans: transaction to reset + * @flags: transaction reset flags. + * + * While iterating over nodes or updating nodes a attempt to lock a btree + * node may return EINTR when the trylock fails. When this occurs + * bch2_trans_reset() or bch2_trans_begin() should be called and the + * transaction retried. + * + * Transaction reset flags include: + * + * - TRANS_RESET_NOUNLOCK - Do not attempt to unlock and reschedule the + * transaction. + * - TRANS_RESET_NOTRAVERSE - Do not traverse all linked iters. + */ void bch2_trans_reset(struct btree_trans *trans, unsigned flags) { struct btree_iter *iter; |