mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 10:45:49 +00:00
bcachefs: Fix a use after free
Turns out, we weren't waiting on in flight btree writes when freeing existing btree nodes. This lead to stray btree writes overwriting newly allocated buckets, but only started showing itself with some of the recent allocator work and another patch to move submitting of btree writes to worqueues. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
8ce600d447
commit
4d47b21c4d
@ -887,6 +887,14 @@ void bch2_btree_interior_update_will_free_node(struct btree_update *as,
|
||||
btree_update_drop_new_node(c, b);
|
||||
|
||||
btree_update_will_delete_key(as, &b->key);
|
||||
|
||||
/*
|
||||
* XXX: Waiting on io with btree node locks held, we don't want to be
|
||||
* doing this. We can't have btree writes happening after the space has
|
||||
* been freed, but we really only need to block before
|
||||
* btree_update_nodes_written_trans() happens.
|
||||
*/
|
||||
btree_node_wait_on_io(b);
|
||||
}
|
||||
|
||||
void bch2_btree_update_done(struct btree_update *as)
|
||||
|
Loading…
Reference in New Issue
Block a user