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 <[email protected]>
> Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]>
> 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