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: Emanuele Giuseppe Esposito
Subject: Re: [PATCH v8 05/20] job.c: add job_lock/unlock while keeping job.h intact
Date: Tue, 5 Jul 2022 10:07:40 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0


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




reply via email to

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