Commit 198141e5 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix null ptr deref in fsck_inode_rm()

bch2_btree_delete_range() can split compressed extents, thus needs to
pass in a disk reservation when we're operating on extents btrees.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent bf0fdb4d
......@@ -1452,6 +1452,8 @@ int bch2_btree_delete_range_trans(struct btree_trans *trans, enum btree_id id,
(k = bch2_btree_iter_peek(&iter)).k) &&
!(ret = bkey_err(k)) &&
bkey_cmp(iter.pos, end) < 0) {
struct disk_reservation disk_res =
bch2_disk_reservation_init(trans->c, 0);
struct bkey_i delete;
bkey_init(&delete.k);
......@@ -1486,8 +1488,9 @@ int bch2_btree_delete_range_trans(struct btree_trans *trans, enum btree_id id,
}
ret = bch2_trans_update(trans, &iter, &delete, 0) ?:
bch2_trans_commit(trans, NULL, journal_seq,
bch2_trans_commit(trans, &disk_res, journal_seq,
BTREE_INSERT_NOFAIL);
bch2_disk_reservation_put(trans->c, &disk_res);
if (ret)
break;
}
......
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