diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-03-26 17:14:43 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-03-31 20:36:11 -0400 |
commit | 40cb26233a060aeb936de7ea1f6ac2659ed9951c (patch) | |
tree | 1e7b1e302a02cf5a785b7e1b26d217bde38e2215 /fs/bcachefs/btree_update_interior.c | |
parent | 048f47e83fc315499dc1943176b3ebe1a55574fb (diff) | |
download | linux-stable-40cb26233a060aeb936de7ea1f6ac2659ed9951c.tar.gz linux-stable-40cb26233a060aeb936de7ea1f6ac2659ed9951c.tar.bz2 linux-stable-40cb26233a060aeb936de7ea1f6ac2659ed9951c.zip |
bcachefs: Be careful about btree node splits during journal replay
Don't pick a pivot that's going to be deleted.
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 | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c index b2f5f2e50f7e..b45c7ced15d8 100644 --- a/fs/bcachefs/btree_update_interior.c +++ b/fs/bcachefs/btree_update_interior.c @@ -1380,9 +1380,16 @@ static void __btree_split_node(struct btree_update *as, if (bkey_deleted(k)) continue; + uk = bkey_unpack_key(b, k); + + if (b->c.level && + u64s < n1_u64s && + u64s + k->u64s >= n1_u64s && + bch2_key_deleted_in_journal(trans, b->c.btree_id, b->c.level, uk.p)) + n1_u64s += k->u64s; + i = u64s >= n1_u64s; u64s += k->u64s; - uk = bkey_unpack_key(b, k); if (!i) n1_pos = uk.p; bch2_bkey_format_add_key(&format[i], &uk); |