Am 11/07/2022 um 16:51 schrieb Vladimir Sementsov-Ogievskiy:
> On 7/6/22 23:15, Emanuele Giuseppe Esposito wrote:
>> iostatus is the only field (together with .job) that needs
>> protection using the job mutex.
>>
>> It is set in the main loop (GLOBAL_STATE functions) but read
>> in I/O code (block_job_error_action).
>>
>> In order to protect it, change block_job_iostatus_set_err
>> to block_job_iostatus_set_err_locked(), always called under
>> job lock.
>>
>> Signed-off-by: Emanuele Giuseppe Esposito <eespo...@redhat.com>
>
> Seems, that (and previous) patch should go before 15.
Why?
>
>> ---
>> blockjob.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/blockjob.c b/blockjob.c
>> index a2559b97a7..893c8ff08e 100644
>> --- a/blockjob.c
>> +++ b/blockjob.c
>> @@ -367,7 +367,8 @@ BlockJobInfo *block_job_query(BlockJob *job, Error
>> **errp)
>> return block_job_query_locked(job, errp);
>> }
>> -static void block_job_iostatus_set_err(BlockJob *job, int error)
>> +/* Called with job lock held */
>> +static void block_job_iostatus_set_err_locked(BlockJob *job, int error)
>> {
>> if (job->iostatus == BLOCK_DEVICE_IO_STATUS_OK) {
>> job->iostatus = error == ENOSPC ?
>> BLOCK_DEVICE_IO_STATUS_NOSPACE :
>> @@ -586,8 +587,8 @@ BlockErrorAction block_job_error_action(BlockJob
>> *job, BlockdevOnError on_err,
>> */
>> job->job.user_paused = true;
>> }
>> + block_job_iostatus_set_err_locked(job, error);
>> }
>> - block_job_iostatus_set_err(job, error);
>> }
>> return action;
>> }
>
>