Commit 8ede9910 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Handle transaction restarts in __bch2_move_data()

We weren't checking for -EINTR in the main loop in __bch2_move_data -
this code predates modern transaction restarts.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent d5030164
......@@ -701,17 +701,20 @@ static int __bch2_move_data(struct bch_fs *c,
bch2_trans_begin(&trans);
k = bch2_btree_iter_peek(&iter);
stats->pos = iter.pos;
if (!k.k)
break;
ret = bkey_err(k);
if (ret == -EINTR)
continue;
if (ret)
break;
if (bkey_cmp(bkey_start_pos(k.k), end) >= 0)
break;
stats->pos = iter.pos;
if (!bkey_extent_is_direct_data(k.k))
goto next_nondata;
......@@ -754,10 +757,8 @@ static int __bch2_move_data(struct bch_fs *c,
ret2 = bch2_move_extent(&trans, ctxt, wp, io_opts, btree_id, k,
data_cmd, data_opts);
if (ret2) {
if (ret2 == -EINTR) {
bch2_trans_begin(&trans);
if (ret2 == -EINTR)
continue;
}
if (ret2 == -ENOMEM) {
/* memory allocation failure, wait for some IO to finish */
......
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