mirror of https://github.com/schoebel/mars
copy: safeguard advance on concluded states
This commit is contained in:
parent
1e551e624b
commit
2d5b708ff6
|
@ -846,6 +846,7 @@ int _run_copy(struct copy_brick *brick, loff_t this_start)
|
|||
unsigned len;
|
||||
unsigned index = GET_INDEX(pos);
|
||||
struct copy_state *st = &GET_STATE(brick, index);
|
||||
bool is_active;
|
||||
|
||||
if (st->state != COPY_STATE_FINISHED) {
|
||||
break;
|
||||
|
@ -870,6 +871,16 @@ int _run_copy(struct copy_brick *brick, loff_t this_start)
|
|||
}
|
||||
break;
|
||||
}
|
||||
is_active =
|
||||
(READ_ONCE(st->active[0]) |
|
||||
READ_ONCE(st->active[1])) != 0;
|
||||
if (is_active) {
|
||||
break;
|
||||
}
|
||||
if (READ_ONCE(st->table[0]) ||
|
||||
READ_ONCE(st->table[1])) {
|
||||
break;
|
||||
}
|
||||
// rollover
|
||||
st->state = COPY_STATE_START;
|
||||
len = st->len;
|
||||
|
|
Loading…
Reference in New Issue