diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-04-09 20:14:21 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-05-08 17:29:19 -0400 |
commit | fd104e2967b766f1151b4c58daa67cbde620b376 (patch) | |
tree | 4ca9502853cee2b36e5b92cd96ddf33654b55f4b /fs/bcachefs/btree_locking.c | |
parent | e590e4e2229409d0e5dc6575a75488d5ebc33b45 (diff) | |
download | lwn-fd104e2967b766f1151b4c58daa67cbde620b376.tar.gz lwn-fd104e2967b766f1151b4c58daa67cbde620b376.zip |
bcachefs: bch2_trans_verify_not_unlocked()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_locking.c')
-rw-r--r-- | fs/bcachefs/btree_locking.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/bcachefs/btree_locking.c b/fs/bcachefs/btree_locking.c index 7824a7a2e50f..c3e9b0cc7bbd 100644 --- a/fs/bcachefs/btree_locking.c +++ b/fs/bcachefs/btree_locking.c @@ -773,14 +773,16 @@ out: static inline int __bch2_trans_relock(struct btree_trans *trans, bool trace) { - struct btree_path *path; - unsigned i; + bch2_trans_verify_locks(trans); if (unlikely(trans->restarted)) return -((int) trans->restarted); if (unlikely(trans->locked)) goto out; + struct btree_path *path; + unsigned i; + trans_for_each_path(trans, path, i) { struct get_locks_fail f; @@ -881,6 +883,11 @@ static bool bch2_trans_locked(struct btree_trans *trans) void bch2_trans_verify_locks(struct btree_trans *trans) { + if (!trans->locked) { + BUG_ON(bch2_trans_locked(trans)); + return; + } + struct btree_path *path; unsigned i; |