]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bcachefs: Fix btree_trans_peek_key_cache()
authorKent Overstreet <kent.overstreet@linux.dev>
Tue, 21 Jan 2025 07:26:13 +0000 (02:26 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Tue, 21 Jan 2025 17:26:25 +0000 (12:26 -0500)
commita8581752278ef9d6ea73bb10eef2657bfb73e116
tree3f286d5f1a9a8e2e075f77def84b347f2ba239c5
parentff0b7ed607e779f0e109f7f24388e0ce07af2ebe
bcachefs: Fix btree_trans_peek_key_cache()

BTREE_ITER_cached_nofill has some tricky corner cases; it's used
internally for iterators that aren't walking the key cache, but need to
be coherent with the key cache.

It tells traverse to look up and lock the key cache entry if present,
but don't create one if it doesn't exist.

That means we have to have a BTREE_ITER_UPTODATE path (because after
traverse the path has to be UPTODATE, or we pop assertions) that doesn't
point to anything (which is the less bad option, taken by the previous
fix).

The previous fix for this path missed an issue that can happen in
bch2_trans_peek_key_cache(): we can't set should_be_locked on a path
that doesn't point to anything and doesn't hold locks.

Fixes: bd5b09727f3d ("bcachefs: Don't set btree_path to updtodate if we don't fill")
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_iter.c
fs/bcachefs/btree_key_cache.c