qemu-block
[Top][All Lists]
Advanced

[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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]