[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/3] job: use complete(do_graph_change=false) to handle soft canc
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH 2/3] job: use complete(do_graph_change=false) to handle soft cancel |
Date: |
Tue, 27 Jul 2021 19:47:53 +0300 |
Soft cancel of READY mirror is more like completion than cancelling. We
have bugs and misunderstanding because of this feature. Now, let's
handle it the other way to drop force cancelling at all in the
following commit.
This makes internal implementation cleaner. Still, we should deprecate
and drop old interface (through block-job-cancel) as a separate step.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
blockdev.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/blockdev.c b/blockdev.c
index 3d8ac368a1..c4ee5f02f4 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3366,7 +3366,16 @@ void qmp_block_job_cancel(const char *device,
}
trace_qmp_block_job_cancel(job);
- job_user_cancel(&job->job, force, errp);
+ if (!force && job_is_ready(&job->job)) {
+ /*
+ * Hack to support old mirror soft-cancel. Please add new API to do
+ * complete with disabled graph-change, deprecate soft-cancel and
+ * finally drop this code.
+ */
+ job_complete_ex(&job->job, false, errp);
+ } else {
+ job_user_cancel(&job->job, force, errp);
+ }
out:
aio_context_release(aio_context);
}
--
2.29.2
- [PATCH RFC 0/3] mirror: rework soft-cancelling READY mirror, Vladimir Sementsov-Ogievskiy, 2021/07/27
- [PATCH 1/3] job: add job_complete_ex with do_graph_change argument, Vladimir Sementsov-Ogievskiy, 2021/07/27
- [PATCH 2/3] job: use complete(do_graph_change=false) to handle soft cancel,
Vladimir Sementsov-Ogievskiy <=
- [PATCH 3/3] job: drop force argument of *job*cancel, Vladimir Sementsov-Ogievskiy, 2021/07/27
- Re: [PATCH RFC 0/3] mirror: rework soft-cancelling READY mirror, Vladimir Sementsov-Ogievskiy, 2021/07/27
- Re: [PATCH RFC 0/3] mirror: rework soft-cancelling READY mirror, Max Reitz, 2021/07/28
- Re: [PATCH RFC 0/3] mirror: rework soft-cancelling READY mirror, Vladimir Sementsov-Ogievskiy, 2021/07/29
- Re: [PATCH RFC 0/3] mirror: rework soft-cancelling READY mirror, Max Reitz, 2021/07/29
- Re: [PATCH RFC 0/3] mirror: rework soft-cancelling READY mirror, Vladimir Sementsov-Ogievskiy, 2021/07/29
- Re: [PATCH RFC 0/3] mirror: rework soft-cancelling READY mirror, Max Reitz, 2021/07/29
- Re: [PATCH RFC 0/3] mirror: rework soft-cancelling READY mirror, Vladimir Sementsov-Ogievskiy, 2021/07/29
- Re: [PATCH RFC 0/3] mirror: rework soft-cancelling READY mirror, Max Reitz, 2021/07/30