bcachefs: Add a debug assert
authorKent Overstreet <kent.overstreet@linux.dev>
Mon, 19 Sep 2022 18:14:01 +0000 (14:14 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:41 +0000 (17:09 -0400)
Chasing down a strange locking bug.

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

index 1650ba87ef03c12f704a6acfb4df9b719f3bab4a..df9949cef9079fe0e52cd19838b28a36e87dbd75 100644 (file)
@@ -1110,6 +1110,9 @@ static int btree_path_traverse_one(struct btree_trans *trans,
 
        path->level = btree_path_up_until_good_node(trans, path, 0);
 
+       EBUG_ON(btree_path_node(path, path->level) &&
+               !btree_node_locked(path, path->level));
+
        /*
         * Note: path->nodes[path->level] may be temporarily NULL here - that
         * would indicate to other code that we got to the end of the btree,