[PATCH 2/6] nodedev: Wait for device initialization in nodeDeviceCreate()

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


On 4/13/21 4:14 PM, Erik Skultety wrote:
> On Tue, Apr 13, 2021 at 12:01:53PM +0200, Michal Privoznik wrote:
>> Although I have not experienced this in real life, there is a
>> possible race condition when creating new device. If the nodedev
>> driver is still enumerating devices (in a separate thread) and
>> virNodeDeviceCreate() is called then it can lead to spurious
>> results because the device enumeration thread is removing devices
>> from or adding them to the internal list of devices (among with
>> their states).
>>
>> Therefore, wait for things to settle down before proceeding with
>> nodeDeviceCreate().
> 
> Hmm, correct. Looking at the source - nodeDeviceGetXMLDesc,
> nodeDeviceGetParent and nodeDeviceNumOfCaps are the only exceptions as far as
> public API mappings go. Would you mind extending this patch?

Good catch. In fact there's a fourth one - nodeDeviceListCaps.
Is it okay to fix locally or do you want me to send v2?

Michal




More information about the libvir-list mailing list