[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH for-6.1? v2 3/7] job: @force parameter for job_cancel_sync{,_
From: |
Kevin Wolf |
Subject: |
Re: [PATCH for-6.1? v2 3/7] job: @force parameter for job_cancel_sync{,_all}() |
Date: |
Tue, 3 Aug 2021 16:00:35 +0200 |
Am 26.07.2021 um 16:46 hat Max Reitz geschrieben:
> 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.
>
> 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: Max Reitz <mreitz@redhat.com>
> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> diff --git a/job.c b/job.c
> index e7a5d28854..9e971d64cf 100644
> --- a/job.c
> +++ b/job.c
> @@ -763,7 +763,12 @@ static void job_completed_txn_abort(Job *job)
> if (other_job != job) {
> ctx = other_job->aio_context;
> aio_context_acquire(ctx);
> - job_cancel_async(other_job, false);
> + /*
> + * This is a transaction: If one job failed, no result will
> matter.
> + * Therefore, pass force=true to terminate all other jobs as
> quickly
> + * as possible.
> + */
> + job_cancel_async(other_job, true);
> aio_context_release(ctx);
> }
> }
Sneaking in a hunk that is unrelated to what the commit message
promises? How naughty! :-)
(But I guess the change makes sense.)
Kevin
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH for-6.1? v2 3/7] job: @force parameter for job_cancel_sync{,_all}(),
Kevin Wolf <=