]> www.infradead.org Git - users/hch/configfs.git/commit
bcachefs: btree_cache.freeable list fixes
authorKent Overstreet <kent.overstreet@linux.dev>
Thu, 31 Oct 2024 05:17:54 +0000 (01:17 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 7 Nov 2024 21:48:21 +0000 (16:48 -0500)
commitbaefd3f849ed956d4c1aee80889093cf0d9c6a94
treed56d625de1ea43240d6d974538d2c96bd75529ab
parent9bb33852f5cc145b17d96f3792ff69148a37e1fd
bcachefs: btree_cache.freeable list fixes

When allocating new btree nodes, we were leaving them on the freeable
list - unlocked - allowing them to be reclaimed: ouch.

Additionally, bch2_btree_node_free_never_used() ->
bch2_btree_node_hash_remove was putting it on the freelist, while
bch2_btree_node_free_never_used() was putting it back on the btree
update reserve list - ouch.

Originally, the code was written to always keep btree nodes on a list -
live or freeable - and this worked when new nodes were kept locked.

But now with the cycle detector, we can't keep nodes locked that aren't
tracked by the cycle detector; and this is fine as long as they're not
reachable.

We also have better and more robust leak detection now, with memory
allocation profiling, so the original justification no longer applies.

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