Skip to content

Commit 3f10048

Browse files
author
Kent Overstreet
committed
bcachefs: Disable merges from interior update path
There's been a bug in the btree write buffer where it wasn't triggering btree node merges - and leaving behind a bunch of nearly empty btree nodes. Then during journal replay, when updates to the backpointers btree aren't using the btree write buffer (because we require synchronization with journal replay), we end up doing those merges all at once. Then if it's the interior update path running them, we deadlock because those run with the highest watermark. There's no real need for the interior update path to be doing btree node merges; other code paths can handle that at lower watermarks. Signed-off-by: Kent Overstreet <[email protected]>
1 parent 9054ef2 commit 3f10048

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

fs/bcachefs/btree_update_interior.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,6 +1926,16 @@ int __bch2_foreground_maybe_merge(struct btree_trans *trans,
19261926
BUG_ON(!trans->paths[path].should_be_locked);
19271927
BUG_ON(!btree_node_locked(&trans->paths[path], level));
19281928

1929+
/*
1930+
* Work around a deadlock caused by the btree write buffer not doing
1931+
* merges and leaving tons of merges for us to do - we really don't need
1932+
* to be doing merges at all from the interior update path, and if the
1933+
* interior update path is generating too many new interior updates we
1934+
* deadlock:
1935+
*/
1936+
if ((flags & BCH_WATERMARK_MASK) == BCH_WATERMARK_interior_updates)
1937+
return 0;
1938+
19291939
flags &= ~BCH_WATERMARK_MASK;
19301940

19311941
b = trans->paths[path].l[level].b;

0 commit comments

Comments
 (0)