Re: [PATCH v5 18/20] jobs: protect job.aio_context with BQL and job_mutex

2022-03-10 Thread Emanuele Giuseppe Esposito
Am 08/03/2022 um 14:41 schrieb Stefan Hajnoczi: > It's not clear to me that .get_parent_aio_context() should only be > called from the main thread. The API is read-only so someone might try > to call from I/O code in the future expecting it to work like other > read-only graph APIs that are avai

Re: [PATCH v5 18/20] jobs: protect job.aio_context with BQL and job_mutex

2022-03-08 Thread Stefan Hajnoczi
On Tue, Feb 08, 2022 at 09:35:11AM -0500, Emanuele Giuseppe Esposito wrote: > static AioContext *child_job_get_parent_aio_context(BdrvChild *c) > { > BlockJob *job = c->opaque; > +assert(qemu_in_main_thread()); > > return job->job.aio_context; > } It's not clear to me that .get_

[PATCH v5 18/20] jobs: protect job.aio_context with BQL and job_mutex

2022-02-08 Thread Emanuele Giuseppe Esposito
In order to make it thread safe, implement a "fake rwlock", where we allow reads under BQL *or* job_mutex held, but writes only under BQL *and* job_mutex. The only write we have is in child_job_set_aio_ctx, which always happens under drain (so the job is paused). For this reason, introduce job_set