Commit 75923ba7 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix a null ptr deref during journal replay

We were calling bch2_extent_can_insert() incorrectly; it should only be
called when the extents-to-keys pass is running because that's when we
could be splitting a compressed extent. Calling bch2_extent_can_insert()
without passing in a disk reservation was causing a null ptr deref.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 47c46c95
...@@ -309,7 +309,7 @@ btree_key_can_insert(struct btree_trans *trans, ...@@ -309,7 +309,7 @@ btree_key_can_insert(struct btree_trans *trans,
if (unlikely(btree_node_old_extent_overwrite(b))) if (unlikely(btree_node_old_extent_overwrite(b)))
return BTREE_INSERT_BTREE_NODE_FULL; return BTREE_INSERT_BTREE_NODE_FULL;
ret = !btree_node_is_extents(b) ret = !(iter->flags & BTREE_ITER_IS_EXTENTS)
? BTREE_INSERT_OK ? BTREE_INSERT_OK
: bch2_extent_can_insert(trans, iter, insert); : bch2_extent_can_insert(trans, iter, insert);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment