]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: Add a missing btree_path_set_dirty() calls
authorKent Overstreet <kent.overstreet@gmail.com>
Wed, 30 Mar 2022 17:10:03 +0000 (13:10 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:28 +0000 (17:09 -0400)
bch2_btree_iter_next_node() was mucking with other btree_path state
without setting path->update to be consistent with the fact that the
path is very much no longer uptodate - oops.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_update_interior.c

index cfaab8cbcad0cb04bcbddb8c6717ed02db62aa16..bfba10b1c1277b142122bac13c809e8344ed1798 100644 (file)
@@ -1701,6 +1701,7 @@ __bch2_btree_path_set_pos(struct btree_trans *trans,
        l = btree_path_up_until_good_node(trans, path, cmp);
 
        if (btree_path_node(path, l)) {
+               BUG_ON(!btree_node_locked(path, l));
                /*
                 * We might have to skip over many keys, or just a few: try
                 * advancing the node iterator, and if we have to skip over too
@@ -1906,6 +1907,8 @@ struct btree_path *bch2_path_get(struct btree_trans *trans,
        int i;
 
        BUG_ON(trans->restarted);
+       bch2_trans_verify_locks(trans);
+
        btree_trans_sort_paths(trans);
 
        btree_trans_sort_paths(trans);
@@ -2098,6 +2101,7 @@ struct btree *bch2_btree_iter_next_node(struct btree_iter *iter)
                btree_node_unlock(path, path->level);
                path->l[path->level].b = BTREE_ITER_NO_NODE_UP;
                path->level++;
+               btree_path_set_dirty(path, BTREE_ITER_NEED_TRAVERSE);
                return NULL;
        }
 
@@ -2105,6 +2109,7 @@ struct btree *bch2_btree_iter_next_node(struct btree_iter *iter)
                __bch2_btree_path_unlock(path);
                path->l[path->level].b = BTREE_ITER_NO_NODE_GET_LOCKS;
                path->l[path->level + 1].b = BTREE_ITER_NO_NODE_GET_LOCKS;
+               btree_path_set_dirty(path, BTREE_ITER_NEED_TRAVERSE);
                trace_trans_restart_relock_next_node(trans->fn, _THIS_IP_,
                                           path->btree_id, &path->pos);
                btree_trans_restart(trans);
index 43022b340f4e69855c9444f9baf68a0b9a375862..53e35d878657e1f6d0f6c2c40d396ac8f3764789 100644 (file)
@@ -1938,6 +1938,7 @@ static int __bch2_btree_node_update_key(struct btree_trans *trans,
                btree_node_unlock(iter2.path, iter2.path->level);
                path_l(iter2.path)->b = BTREE_ITER_NO_NODE_UP;
                iter2.path->level++;
+               btree_path_set_dirty(iter2.path, BTREE_ITER_NEED_TRAVERSE);
 
                trans->paths_sorted = false;