[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 11/13] mirror: Stop active mirroring after force-cancel
From: |
Hanna Reitz |
Subject: |
[PATCH v5 11/13] mirror: Stop active mirroring after force-cancel |
Date: |
Wed, 6 Oct 2021 17:19:38 +0200 |
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>
---
block/mirror.c | 2 ++
1 file changed, 2 insertions(+)
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) {
--
2.31.1
- Re: [PATCH v5 05/13] job: @force parameter for job_cancel_sync(), (continued)
- [PATCH v5 09/13] mirror: Use job_is_cancelled(), Hanna Reitz, 2021/10/06
- [PATCH v5 07/13] job: Do not soft-cancel after a job is done, Hanna Reitz, 2021/10/06
- [PATCH v5 06/13] jobs: Give Job.force_cancel more meaning, Hanna Reitz, 2021/10/06
- [PATCH v5 08/13] job: Add job_cancel_requested(), Hanna Reitz, 2021/10/06
- [PATCH v5 12/13] mirror: Do not clear .cancelled, Hanna Reitz, 2021/10/06
- [PATCH v5 11/13] mirror: Stop active mirroring after force-cancel,
Hanna Reitz <=
- [PATCH v5 13/13] iotests: Add mirror-ready-cancel-error test, Hanna Reitz, 2021/10/06
- [PATCH v5 10/13] mirror: Check job_is_cancelled() earlier, Hanna Reitz, 2021/10/06
- Re: [PATCH v5 00/13] mirror: Handle errors after READY cancel, Vladimir Sementsov-Ogievskiy, 2021/10/07