Commit d8648425 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: btree_path_make_mut() clears should_be_locked

This fixes a bug where __bch2_btree_node_update_key() wasn't clearing
should_be_locked, leading to bch2_btree_path_traverse() always failing -
all callers of btree_path_make_mut() want should_be_locked cleared, so
do it there.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent 7071878b
...@@ -1662,9 +1662,8 @@ static struct btree_path *btree_path_clone(struct btree_trans *trans, struct btr ...@@ -1662,9 +1662,8 @@ static struct btree_path *btree_path_clone(struct btree_trans *trans, struct btr
return new; return new;
} }
struct btree_path * __must_check struct btree_path *__bch2_btree_path_make_mut(struct btree_trans *trans,
__bch2_btree_path_make_mut(struct btree_trans *trans, struct btree_path *path, bool intent)
struct btree_path *path, bool intent)
{ {
__btree_path_put(path, intent); __btree_path_put(path, intent);
path = btree_path_clone(trans, path, intent); path = btree_path_clone(trans, path, intent);
...@@ -1672,6 +1671,7 @@ __bch2_btree_path_make_mut(struct btree_trans *trans, ...@@ -1672,6 +1671,7 @@ __bch2_btree_path_make_mut(struct btree_trans *trans,
#ifdef CONFIG_BCACHEFS_DEBUG #ifdef CONFIG_BCACHEFS_DEBUG
path->ip_allocated = _RET_IP_; path->ip_allocated = _RET_IP_;
#endif #endif
path->should_be_locked = false;
return path; return path;
} }
...@@ -1688,7 +1688,6 @@ __bch2_btree_path_set_pos(struct btree_trans *trans, ...@@ -1688,7 +1688,6 @@ __bch2_btree_path_set_pos(struct btree_trans *trans,
path = bch2_btree_path_make_mut(trans, path, intent); path = bch2_btree_path_make_mut(trans, path, intent);
path->pos = new_pos; path->pos = new_pos;
path->should_be_locked = false;
trans->paths_sorted = false; trans->paths_sorted = false;
if (unlikely(path->cached)) { if (unlikely(path->cached)) {
......
...@@ -149,6 +149,7 @@ bch2_btree_path_make_mut(struct btree_trans *trans, ...@@ -149,6 +149,7 @@ bch2_btree_path_make_mut(struct btree_trans *trans,
{ {
if (path->ref > 1 || path->preserve) if (path->ref > 1 || path->preserve)
path = __bch2_btree_path_make_mut(trans, path, intent); path = __bch2_btree_path_make_mut(trans, path, intent);
path->should_be_locked = false;
return path; return path;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment