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

Re: [libvirt] [PATCH v2] virnetdevmacvlan.c: Introduce mutex for macvlan creation



On 01.03.2013 11:45, Daniel P. Berrange wrote:
> On Fri, Mar 01, 2013 at 11:36:24AM +0100, Michal Privoznik wrote:
>> Currently, after we removed the qemu driver lock, it may happen
>> that two or more threads will start up a machine with macvlan and
>> race over virNetDevMacVLanCreateWithVPortProfile(). However,
>> there's a racy section in which we are generating a sequence of
>> possible device names and detecting if they exits. If we found
>> one which doesn't we try to create a device with that name.
>> However, the other thread is doing just the same. Assume it will
>> succeed and we must therefore fail. If this happens more than 5
>> times (which in massive parallel startup surely will) we return
>> -1 without any error reported. This patch is a simple hack to
>> both of these problems. It introduces a mutex, so only one thread
>> will enter the section, and if it runs out of possibilities,
>> error is reported. Moreover, the number of retries is raised to 20.
>> ---
>>
>> diff to v1:
>> -don't increase @retries
>> -move error reporting to virNetDevMacVLanCreateMutexOnceInit
>>
>>  src/util/virnetdevmacvlan.c | 37 ++++++++++++++++++++++++++++++++-----
>>  1 file changed, 32 insertions(+), 5 deletions(-)
>>

> 
> ACK
> 
> Daniel
> 

Thanks, pushed.

Michal


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