[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 05/12] job: @force parameter for job_cancel_sync()
From: |
Eric Blake |
Subject: |
Re: [PATCH v4 05/12] job: @force parameter for job_cancel_sync() |
Date: |
Wed, 8 Sep 2021 11:20:45 -0500 |
User-agent: |
NeoMutt/20210205-739-420e15 |
On Tue, Sep 07, 2021 at 02:42:38PM +0200, Hanna Reitz wrote:
> Callers should be able to specify whether they want job_cancel_sync() to
> force-cancel the job or not.
>
> In fact, almost all invocations do not care about consistency of the
> result and just want the job to terminate as soon as possible, so they
> should pass force=true. The replication block driver is the exception,
> specifically the active commit job it runs.
>
> As for job_cancel_sync_all(), all callers want it to force-cancel all
> jobs, because that is the point of it: To cancel all remaining jobs as
> quickly as possible (generally on process termination). So make it
> invoke job_cancel_sync() with force=true.
>
> This changes some iotest outputs, because quitting qemu while a mirror
> job is active will now lead to it being cancelled instead of completed,
> which is what we want. (Cancelling a READY mirror job with force=false
> may take an indefinite amount of time, which we do not want when
> quitting. If users want consistent results, they must have all jobs be
> done before they quit qemu.)
>
> Buglink: https://gitlab.com/qemu-project/qemu/-/issues/462
> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
> ---
> include/qemu/job.h | 10 ++---
> block/replication.c | 4 +-
> blockdev.c | 4 +-
> job.c | 18 ++++++--
> tests/unit/test-blockjob.c | 2 +-
> tests/qemu-iotests/109.out | 60 +++++++++++----------------
> tests/qemu-iotests/tests/qsd-jobs.out | 2 +-
> 7 files changed, 50 insertions(+), 50 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 v4 00/12] mirror: Handle errors after READY cancel, Hanna Reitz, 2021/09/07
- [PATCH v4 01/12] job: Context changes in job_completed_txn_abort(), Hanna Reitz, 2021/09/07
- [PATCH v4 03/12] mirror: Drop s->synced, Hanna Reitz, 2021/09/07
- [PATCH v4 04/12] job: Force-cancel jobs in a failed transaction, Hanna Reitz, 2021/09/07
- [PATCH v4 02/12] mirror: Keep s->synced on error, Hanna Reitz, 2021/09/07
- [PATCH v4 05/12] job: @force parameter for job_cancel_sync(), Hanna Reitz, 2021/09/07
- [PATCH v4 06/12] jobs: Give Job.force_cancel more meaning, Hanna Reitz, 2021/09/07
- [PATCH v4 08/12] mirror: Use job_is_cancelled(), Hanna Reitz, 2021/09/07
- [PATCH v4 10/12] mirror: Stop active mirroring after force-cancel, Hanna Reitz, 2021/09/07
- [PATCH v4 11/12] mirror: Do not clear .cancelled, Hanna Reitz, 2021/09/07
- [PATCH v4 09/12] mirror: Check job_is_cancelled() earlier, Hanna Reitz, 2021/09/07
- [PATCH v4 07/12] job: Add job_cancel_requested(), Hanna Reitz, 2021/09/07
- [PATCH v4 12/12] iotests: Add mirror-ready-cancel-error test, Hanna Reitz, 2021/09/07