bcachefs: Add a missing bch2_btree_path_traverse() call
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 9 Dec 2022 21:22:36 +0000 (16:22 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:47 +0000 (17:09 -0400)
bch2_btree_iter_peek_upto() in snapshots mode may need to keep a
btree_path for the insert position, not just the position of the key
we're returning. The code was incorrectly assuming this would be in the
same btree node - we were missing a bch2_btree_path_traverse() call.

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

index ff796a74fd2faeb12e81aa61a392210c23868205..04051e45f4e0563fa15e28aa6a8ed920cdc97c63 100644 (file)
@@ -2063,6 +2063,11 @@ struct bkey_s_c bch2_btree_iter_peek_upto(struct btree_iter *iter, struct bpos e
                        iter->update_path = bch2_btree_path_set_pos(trans,
                                                iter->update_path, pos,
                                                iter->flags & BTREE_ITER_INTENT);
+                       ret = bch2_btree_path_traverse(trans, iter->update_path, iter->flags);
+                       if (unlikely(ret)) {
+                               k = bkey_s_c_err(ret);
+                               goto out_no_locked;
+                       }
                }
 
                /*