]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: btree_path_make_mut() clears should_be_locked
authorKent Overstreet <kent.overstreet@gmail.com>
Wed, 30 Mar 2022 17:47:07 +0000 (13:47 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:28 +0000 (17:09 -0400)
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: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_iter.h

index bfba10b1c1277b142122bac13c809e8344ed1798..3a4ed2f70cc21219b4180d25dfd231de5db19abf 100644 (file)
@@ -1662,9 +1662,8 @@ static struct btree_path *btree_path_clone(struct btree_trans *trans, struct btr
        return new;
 }
 
-struct btree_path * __must_check
-__bch2_btree_path_make_mut(struct btree_trans *trans,
-                          struct btree_path *path, bool intent)
+struct btree_path *__bch2_btree_path_make_mut(struct btree_trans *trans,
+                        struct btree_path *path, bool intent)
 {
        __btree_path_put(path, intent);
        path = btree_path_clone(trans, path, intent);
@@ -1672,6 +1671,7 @@ __bch2_btree_path_make_mut(struct btree_trans *trans,
 #ifdef CONFIG_BCACHEFS_DEBUG
        path->ip_allocated = _RET_IP_;
 #endif
+       path->should_be_locked = false;
        return path;
 }
 
@@ -1688,7 +1688,6 @@ __bch2_btree_path_set_pos(struct btree_trans *trans,
        path = bch2_btree_path_make_mut(trans, path, intent);
 
        path->pos               = new_pos;
-       path->should_be_locked  = false;
        trans->paths_sorted     = false;
 
        if (unlikely(path->cached)) {
index 30a2a2cef29bc507480e1f22af3a2795a1a6bb3f..29c1df83b35ebffa57b8117c841a5cddf4a79fd3 100644 (file)
@@ -149,6 +149,7 @@ bch2_btree_path_make_mut(struct btree_trans *trans,
 {
        if (path->ref > 1 || path->preserve)
                path = __bch2_btree_path_make_mut(trans, path, intent);
+       path->should_be_locked = false;
        return path;
 }