diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-04-13 18:39:03 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-04-13 22:49:25 -0400 |
commit | 3f10048973c8366e27147d72bf3fd8d0e1d929f2 (patch) | |
tree | 0d958fc944434c2fed78c233146e0dc917da37d6 /fs/bcachefs/btree_update_interior.c | |
parent | 9054ef2ea944528b7935d0ce3f540d4dc0bc37ba (diff) | |
download | linux-stable-3f10048973c8366e27147d72bf3fd8d0e1d929f2.tar.gz linux-stable-3f10048973c8366e27147d72bf3fd8d0e1d929f2.tar.bz2 linux-stable-3f10048973c8366e27147d72bf3fd8d0e1d929f2.zip |
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 <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_update_interior.c')
-rw-r--r-- | fs/bcachefs/btree_update_interior.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c index 1a7537ee4329..82ac00aa0f7b 100644 --- a/fs/bcachefs/btree_update_interior.c +++ b/fs/bcachefs/btree_update_interior.c @@ -1926,6 +1926,16 @@ int __bch2_foreground_maybe_merge(struct btree_trans *trans, BUG_ON(!trans->paths[path].should_be_locked); BUG_ON(!btree_node_locked(&trans->paths[path], level)); + /* + * Work around a deadlock caused by the btree write buffer not doing + * merges and leaving tons of merges for us to do - we really don't need + * to be doing merges at all from the interior update path, and if the + * interior update path is generating too many new interior updates we + * deadlock: + */ + if ((flags & BCH_WATERMARK_MASK) == BCH_WATERMARK_interior_updates) + return 0; + flags &= ~BCH_WATERMARK_MASK; b = trans->paths[path].l[level].b; |