summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-12-21 10:55:03 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2025-01-10 07:38:41 +0300
commit6adc5af50a5401a19c1f23b3ed2ebfd3a0d8cdc6 (patch)
tree68d956bf665b4127378b4c4cac5cebfc5bd6ec1d
parentf908eacc34c7e8092bd47b7fcf5741943d3b734c (diff)
downloadlinux-6adc5af50a5401a19c1f23b3ed2ebfd3a0d8cdc6.tar.xz
bcachefs: btree_path_very_locks(): verify lock seq
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>
-rw-r--r--fs/bcachefs/btree_locking.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_locking.c b/fs/bcachefs/btree_locking.c
index d343df9f0ad2..b339c209345a 100644
--- a/fs/bcachefs/btree_locking.c
+++ b/fs/bcachefs/btree_locking.c
@@ -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));
}
}