summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-01-20 17:02:56 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:49 -0400
commit7c909f654bae57083a0965f105e52ac8737a0785 (patch)
tree5e2c709c91589cc25272b920c1158a80d4ecad8e /fs/bcachefs
parent0329631c9165d2dddd5a89da5f72f3175011b49f (diff)
downloadlinux-stable-7c909f654bae57083a0965f105e52ac8737a0785.tar.gz
linux-stable-7c909f654bae57083a0965f105e52ac8737a0785.tar.bz2
linux-stable-7c909f654bae57083a0965f105e52ac8737a0785.zip
bcachefs: Fix repair path in bch2_mark_reflink_p()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs')
-rw-r--r--fs/bcachefs/buckets.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c
index 4fd396cb1dad..6c9dcfd54be6 100644
--- a/fs/bcachefs/buckets.c
+++ b/fs/bcachefs/buckets.c
@@ -1213,17 +1213,23 @@ not_found:
" missing range %llu-%llu",
(bch2_bkey_val_to_text(&buf, c, p.s_c), buf.buf),
*idx, next_idx)) {
- struct bkey_i_error new;
-
- bkey_init(&new.k);
- new.k.type = KEY_TYPE_error;
- new.k.p = bkey_start_pos(p.k);
- new.k.p.offset += *idx - start;
- bch2_key_resize(&new.k, next_idx - *idx);
- ret = __bch2_btree_insert(trans, BTREE_ID_extents, &new.k_i);
+ struct bkey_i_error *new;
+
+ new = bch2_trans_kmalloc(trans, sizeof(*new));
+ ret = PTR_ERR_OR_ZERO(new);
+ if (ret)
+ goto err;
+
+ bkey_init(&new->k);
+ new->k.type = KEY_TYPE_error;
+ new->k.p = bkey_start_pos(p.k);
+ new->k.p.offset += *idx - start;
+ bch2_key_resize(&new->k, next_idx - *idx);
+ ret = __bch2_btree_insert(trans, BTREE_ID_extents, &new->k_i);
}
*idx = next_idx;
+err:
fsck_err:
printbuf_exit(&buf);
return ret;