mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-23 19:11:51 +00:00
bcachefs: Make sure to pass a disk reservation to bch2_extent_update()
It's needed when we split an existing compressed extent - we get a null ptr deref without it. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
parent
2cd0563461
commit
2e8f9d23cb
1 changed files with 5 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
|||
#include "bcachefs.h"
|
||||
#include "bkey_buf.h"
|
||||
#include "btree_update.h"
|
||||
#include "buckets.h"
|
||||
#include "extents.h"
|
||||
#include "inode.h"
|
||||
#include "io.h"
|
||||
|
@ -224,6 +225,8 @@ s64 bch2_remap_range(struct bch_fs *c,
|
|||
BTREE_ITER_INTENT);
|
||||
|
||||
while (ret == 0 || ret == -EINTR) {
|
||||
struct disk_reservation disk_res = { 0 };
|
||||
|
||||
bch2_trans_begin(&trans);
|
||||
|
||||
if (fatal_signal_pending(current)) {
|
||||
|
@ -287,8 +290,9 @@ s64 bch2_remap_range(struct bch_fs *c,
|
|||
dst_end.offset - dst_iter->pos.offset));
|
||||
|
||||
ret = bch2_extent_update(&trans, dst_iter, new_dst.k,
|
||||
NULL, journal_seq,
|
||||
&disk_res, journal_seq,
|
||||
new_i_size, i_sectors_delta);
|
||||
bch2_disk_reservation_put(c, &disk_res);
|
||||
if (ret)
|
||||
continue;
|
||||
|
||||
|
|
Loading…
Reference in a new issue