[PATCH 4/6] nodedev: Introduce nodeDeviceInitComplete()

Michal Privoznik mprivozn at redhat.com
Tue Apr 13 15:33:51 UTC 2021


On 4/13/21 4:14 PM, Erik Skultety wrote:
> On Tue, Apr 13, 2021 at 12:01:55PM +0200, Michal Privoznik wrote:
>> When the device enumeration thread finishes it sets the
>> driver->initialized boolean and signals condition to wake up
>> other threads that are waiting for the initialization to
>> complete. Move this code into a separate function so that it can
>> be re-used from other places too.
>>
>> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>> ---
> ....
> 
>> diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
>> index 20a13211a0..68547c6986 100644
>> --- a/src/node_device/node_device_udev.c
>> +++ b/src/node_device/node_device_udev.c
>> @@ -1984,10 +1984,7 @@ nodeStateInitializeEnumerate(void *opaque)
>>       if (nodeDeviceUpdateMediatedDevices() != 0)
>>           goto error;
>>   
>> -    nodeDeviceLock();
>> -    driver->initialized = true;
>> -    virCondBroadcast(&driver->initCond);
>> -    nodeDeviceUnlock();
>> +    nodeDeviceInitComplete();
> 
> well, it will be re-used in the same function after patch 5. I suggest going
> with the old style - introducing a fallthrough cleanup label and adding a 'goto
> cleanup' to the 'error' section. Patch 5 will not be needed in that case.

Fair enough.

Michal




More information about the libvir-list mailing list