Am 25.07.2022 um 09:38 hat Emanuele Giuseppe Esposito geschrieben: > 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> > --- > blockjob.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/blockjob.c b/blockjob.c > index 0663faee2c..448bdb5a53 100644 > --- a/blockjob.c > +++ b/blockjob.c > @@ -363,7 +363,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 : > @@ -577,8 +578,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; > }
Ah, so this patch does what I asked for in an earlier patch. I wonder if it should be squashed there. Vladimir's finding that we have an access in mirror may need a fix, but while incomplete, this patch isn't wrong: Reviewed-by: Kevin Wolf <kw...@redhat.com>