[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH for-6.1? v2 4/7] jobs: Give Job.force_cancel more meaning
From: |
Eric Blake |
Subject: |
Re: [PATCH for-6.1? v2 4/7] jobs: Give Job.force_cancel more meaning |
Date: |
Mon, 26 Jul 2021 16:38:53 -0500 |
User-agent: |
NeoMutt/20210205-647-5d4e008 |
On Mon, Jul 26, 2021 at 04:46:10PM +0200, Max Reitz wrote:
> We largely have two cancel modes for jobs:
>
> First, there is actual cancelling. The job is terminated as soon as
> possible, without trying to reach a consistent result.
>
> Second, we have mirror in the READY state. Technically, the job is not
> really cancelled, but it just is a different completion mode. The job
> can still run for an indefinite amount of time while it tries to reach a
> consistent result.
>
> We want to be able to clearly distinguish which cancel mode a job is in
> (when it has been cancelled). We can use Job.force_cancel for this, but
> right now it only reflects cancel requests from the user with
> force=true, but clearly, jobs that do not even distinguish between
> force=false and force=true are effectively always force-cancelled.
>
> So this patch has Job.force_cancel signify whether the job will
> terminate as soon as possible (force_cancel=true) or whether it will
> effectively remain running despite being "cancelled"
> (force_cancel=false).
>
> To this end, we let jobs that provide JobDriver.cancel() tell the
> generic job code whether they will terminate as soon as possible or not,
> and for jobs that do not provide that method we assume they will.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> include/qemu/job.h | 11 ++++++++++-
> block/backup.c | 3 ++-
> block/mirror.c | 24 ++++++++++++++++++------
> job.c | 6 +++++-
> 4 files changed, 35 insertions(+), 9 deletions(-)
>
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
- [PATCH for-6.1? v2 0/7] mirror: Handle errors after READY cancel, Max Reitz, 2021/07/26
- [PATCH for-6.1? v2 2/7] mirror: Drop s->synced, Max Reitz, 2021/07/26
- [PATCH for-6.1? v2 1/7] mirror: Keep s->synced on error, Max Reitz, 2021/07/26
- [PATCH for-6.1? v2 3/7] job: @force parameter for job_cancel_sync{, _all}(), Max Reitz, 2021/07/26
- [PATCH for-6.1? v2 4/7] jobs: Give Job.force_cancel more meaning, Max Reitz, 2021/07/26
- [PATCH for-6.1? v2 5/7] job: Add job_cancel_requested(), Max Reitz, 2021/07/26
- [PATCH for-6.1? v2 6/7] mirror: Check job_is_cancelled() earlier, Max Reitz, 2021/07/26
- [PATCH for-6.1? v2 7/7] iotests: Add mirror-ready-cancel-error test, Max Reitz, 2021/07/26