Skip to content

Commit b3f8e71

Browse files
author
Kent Overstreet
committed
bcachefs: Fix btree key cache coherency during replay
Signed-off-by: Kent Overstreet <[email protected]>
1 parent 5d04409 commit b3f8e71

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

fs/bcachefs/btree_key_cache.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,11 @@ static int btree_key_cache_fill(struct btree_trans *trans,
380380
struct bkey_i *new_k = NULL;
381381
int ret;
382382

383-
k = bch2_bkey_get_iter(trans, &iter, ck->key.btree_id, ck->key.pos,
384-
BTREE_ITER_KEY_CACHE_FILL|
385-
BTREE_ITER_CACHED_NOFILL);
383+
bch2_trans_iter_init(trans, &iter, ck->key.btree_id, ck->key.pos,
384+
BTREE_ITER_KEY_CACHE_FILL|
385+
BTREE_ITER_CACHED_NOFILL);
386+
iter.flags &= ~BTREE_ITER_WITH_JOURNAL;
387+
k = bch2_btree_iter_peek_slot(&iter);
386388
ret = bkey_err(k);
387389
if (ret)
388390
goto err;

fs/bcachefs/btree_update.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ bch2_trans_update_by_path(struct btree_trans *trans, btree_path_idx_t path_idx,
452452
* the key cache - but the key has to exist in the btree for that to
453453
* work:
454454
*/
455-
if (path->cached && bkey_deleted(&i->old_k))
455+
if (path->cached && !i->old_btree_u64s)
456456
return flush_new_cached_update(trans, i, flags, ip);
457457

458458
return 0;

0 commit comments

Comments
 (0)