bcachefs: Fix a use after free
authorKent Overstreet <kent.overstreet@gmail.com>
Sun, 27 Feb 2022 16:34:21 +0000 (11:34 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:26 +0000 (17:09 -0400)
commitddf11d8c60b0d46dd25520d388243b508d6e9016
tree41932cd7dbe9538f62da918e379832cabbaf1b1c
parent7db4cbd0a52554ddec4cabf2ebd69fc7bcd53a31
bcachefs: Fix a use after free

This fixes a regression from "bcachefs: Stash a copy of key being
overwritten in btree_insert_entry". In btree_key_can_insert_cached(), we
may reallocate the key cache key, invalidating pointers previously
returned by peek() - fix it by issuing a transaction restart.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/btree_update_leaf.c
fs/bcachefs/trace.h