Skip to content

Commit 9b230ef

Browse files
XanClicVladimir Sementsov-Ogievskiy
authored andcommitted
mirror: Stop active mirroring after force-cancel
Once the mirror job is force-cancelled (job_is_cancelled() is true), we should not generate new I/O requests. This applies to active mirroring, too, so stop it once the job is cancelled. (We must still forward all I/O requests to the source, though, of course, but those are not really I/O requests generated by the job, so this is fine.) Signed-off-by: Hanna Reitz <[email protected]> Reviewed-by: Eric Blake <[email protected]> Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]> Message-Id: <[email protected]> Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
1 parent 4feeec7 commit 9b230ef

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

block/mirror.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,7 @@ static int coroutine_fn bdrv_mirror_top_do_write(BlockDriverState *bs,
14251425
bool copy_to_target;
14261426

14271427
copy_to_target = s->job->ret >= 0 &&
1428+
!job_is_cancelled(&s->job->common.job) &&
14281429
s->job->copy_mode == MIRROR_COPY_MODE_WRITE_BLOCKING;
14291430

14301431
if (copy_to_target) {
@@ -1473,6 +1474,7 @@ static int coroutine_fn bdrv_mirror_top_pwritev(BlockDriverState *bs,
14731474
bool copy_to_target;
14741475

14751476
copy_to_target = s->job->ret >= 0 &&
1477+
!job_is_cancelled(&s->job->common.job) &&
14761478
s->job->copy_mode == MIRROR_COPY_MODE_WRITE_BLOCKING;
14771479

14781480
if (copy_to_target) {

0 commit comments

Comments
 (0)