bcachefs: Fix ec_stripe_update_ptrs()

bch2_btree_iter_set_pos() invalidates the key returned by peek().

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2020-03-30 14:05:05 -04:00 committed by Kent Overstreet
parent d06c1a0cbc
commit e5e6aaa797

View File

@ -804,8 +804,6 @@ static int ec_stripe_update_ptrs(struct bch_fs *c,
continue;
}
bch2_btree_iter_set_pos(iter, bkey_start_pos(k.k));
dev = s->key.v.ptrs[idx].dev;
bkey_on_stack_reassemble(&sk, c, k);
@ -820,6 +818,7 @@ static int ec_stripe_update_ptrs(struct bch_fs *c,
extent_stripe_ptr_add(e, s, ec_ptr, idx);
bch2_btree_iter_set_pos(iter, bkey_start_pos(&sk.k->k));
bch2_trans_update(&trans, iter, sk.k, 0);
ret = bch2_trans_commit(&trans, NULL, NULL,