diff options
author | Hanna Reitz | 2021-10-06 17:19:38 +0200 |
---|---|---|
committer | Vladimir Sementsov-Ogievskiy | 2021-10-07 10:42:50 +0200 |
commit | 9b230ef93e406dc46b82eebde996ef6a08b929d6 (patch) | |
tree | 24954b66ddfbee7567bcc0eb3105cab59b275215 /block | |
parent | mirror: Check job_is_cancelled() earlier (diff) | |
download | qemu-9b230ef93e406dc46b82eebde996ef6a08b929d6.tar.gz qemu-9b230ef93e406dc46b82eebde996ef6a08b929d6.tar.xz qemu-9b230ef93e406dc46b82eebde996ef6a08b929d6.zip |
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 <hreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20211006151940.214590-12-hreitz@redhat.com>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/mirror.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/block/mirror.c b/block/mirror.c index 3393ede0e1..75874c1806 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1425,6 +1425,7 @@ static int coroutine_fn bdrv_mirror_top_do_write(BlockDriverState *bs, bool copy_to_target; copy_to_target = s->job->ret >= 0 && + !job_is_cancelled(&s->job->common.job) && s->job->copy_mode == MIRROR_COPY_MODE_WRITE_BLOCKING; if (copy_to_target) { @@ -1473,6 +1474,7 @@ static int coroutine_fn bdrv_mirror_top_pwritev(BlockDriverState *bs, bool copy_to_target; copy_to_target = s->job->ret >= 0 && + !job_is_cancelled(&s->job->common.job) && s->job->copy_mode == MIRROR_COPY_MODE_WRITE_BLOCKING; if (copy_to_target) { |