Skip to content

Commit a24e6e7

Browse files
author
Kent Overstreet
committed
bcachefs: delete faulty fastpath in bch2_btree_path_traverse_cached()
bch2_btree_path_traverse_cached() was previously checking if it could just relock the path, which is a common idiom in path traversal. However, it was using btree_node_relock(), not btree_path_relock(); btree_path_relock() only succeeds if the path was in state BTREE_ITER_NEED_RELOCK. If the path was in state BTREE_ITER_NEED_TRAVERSE a full traversal is needed; this led to a null ptr deref in bch2_btree_path_traverse_cached(). And the short circuit check here isn't needed, since it was already done in the main bch2_btree_path_traverse_one(). Signed-off-by: Kent Overstreet <[email protected]>
1 parent 8a2491d commit a24e6e7

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

fs/bcachefs/btree_key_cache.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -497,11 +497,6 @@ int bch2_btree_path_traverse_cached(struct btree_trans *trans, struct btree_path
497497

498498
path->l[1].b = NULL;
499499

500-
if (bch2_btree_node_relock_notrace(trans, path, 0)) {
501-
path->uptodate = BTREE_ITER_UPTODATE;
502-
return 0;
503-
}
504-
505500
int ret;
506501
do {
507502
ret = btree_path_traverse_cached_fast(trans, path);

0 commit comments

Comments
 (0)