]> www.infradead.org Git - linux.git/commitdiff
bcachefs: btree_path_very_locks(): verify lock seq
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 21 Dec 2024 07:55:03 +0000 (02:55 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Fri, 10 Jan 2025 04:38:41 +0000 (23:38 -0500)
If the btree_path's lock seq is wrong, the next bch2_trans_relock()
operation is guaranteed to fail and we take an unnecessary transaction
restart.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_locking.c

index d343df9f0ad2ebaf9a40af2d8c741ff528388518..b339c209345a2afff992aede4e0f8e4e0bd8bf80 100644 (file)
@@ -856,6 +856,9 @@ void bch2_btree_path_verify_locks(struct btree_path *path)
                       (want == BTREE_NODE_UNLOCKED ||
                        have != BTREE_NODE_WRITE_LOCKED) &&
                       want != have);
+
+               BUG_ON(btree_node_locked(path, l) &&
+                      path->l[l].lock_seq != six_lock_seq(&path->l[l].b->c.lock));
        }
 }