Am 05/07/2022 um 09:39 schrieb Stefan Hajnoczi: > On Wed, Jun 29, 2022 at 10:15:23AM -0400, Emanuele Giuseppe Esposito wrote: >> +void job_ref(Job *job) >> +{ >> + JOB_LOCK_GUARD(); >> + job_ref_locked(job); >> +} > > You don't need to fix this, but just a note: > > This API seems dangerous. If we don't hold the lock, how can we be sure > job won't be unreferenced before we call job_ref()? We would need to be > sure there exists another reference that won't be released until > job_ref() returns... > I guess that's a drawback of using this new serie organization :) This function is just a temporary placeholder to avoid having _locked functions being called without the lock held (see previous serie suggestions from Vladimir and Kevin). Emanuele
- [PATCH v8 00/20] job: replace AioContext lock... Emanuele Giuseppe Esposito
- [PATCH v8 04/20] aio-wait.h: introduce A... Emanuele Giuseppe Esposito
- [PATCH v8 10/20] jobs: add job lock in f... Emanuele Giuseppe Esposito
- Re: [PATCH v8 10/20] jobs: add job l... Stefan Hajnoczi
- [PATCH v8 18/20] block_job_query: remove... Emanuele Giuseppe Esposito
- [PATCH v8 05/20] job.c: add job_lock/unl... Emanuele Giuseppe Esposito
- Re: [PATCH v8 05/20] job.c: add job_... Stefan Hajnoczi
- Re: [PATCH v8 05/20] job.c: add ... Emanuele Giuseppe Esposito
- Re: [PATCH v8 05/20] job.c: ... Stefan Hajnoczi
- Re: [PATCH v8 05/20] job.c: add job_... Stefan Hajnoczi
- Re: [PATCH v8 05/20] job.c: add job_... Vladimir Sementsov-Ogievskiy
- [PATCH v8 07/20] job.h: add _locked publ... Emanuele Giuseppe Esposito
- Re: [PATCH v8 07/20] job.h: add _loc... Stefan Hajnoczi
- Re: [PATCH v8 07/20] job.h: add _loc... Vladimir Sementsov-Ogievskiy
- [PATCH v8 01/20] job.c: make job_mutex a... Emanuele Giuseppe Esposito
- [PATCH v8 11/20] jobs: use job locks als... Emanuele Giuseppe Esposito
- Re: [PATCH v8 11/20] jobs: use job l... Stefan Hajnoczi
- [PATCH v8 19/20] blockjob: remove unused... Emanuele Giuseppe Esposito