qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v8 05/20] job.c: add job_lock/unlock while keeping job.h inta


From: Stefan Hajnoczi
Subject: Re: [PATCH v8 05/20] job.c: add job_lock/unlock while keeping job.h intact
Date: Wed, 6 Jul 2022 11:09:26 +0100

On Tue, Jul 05, 2022 at 10:07:40AM +0200, Emanuele Giuseppe Esposito wrote:
> 
> 
> 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).

Ah, yes, I saw non-locked functions being removed after I reviewed this
patch. A comment would help explain this to reviewers but there's no
need to change it now.

Thanks,
Stefan

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]