bcachefs: Fix an issue with inconsistent btree writes after unclean shutdown
authorKent Overstreet <kent.overstreet@gmail.com>
Sun, 23 May 2021 01:43:20 +0000 (21:43 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:04 +0000 (17:09 -0400)
commit9dd89a05fd946869c23e12fcfb9b9643b337fd56
tree3c52c1769f31ea29c053473f0957b96eacdd0ee9
parent4495cbed568b074c8fbd9a3b761176d38a4955e3
bcachefs: Fix an issue with inconsistent btree writes after unclean shutdown

After unclean shutdown, btree writes may have completed on one device
and not others - and this inconsistency could lead us to writing new
bsets with a gap in our btree node in one of our replicas.

Fortunately, this is only an issue with bsets that are newer than the
most recent journal flush, and we already have a mechanism for detecting
and blacklisting those. We just need to make sure to start new btree
writes after the most recent _non_ blacklisted bset.

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