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

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

 



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().

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/node_device/node_device_driver.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 4678a0fc01..bc8a758c1c 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -1399,6 +1399,9 @@ nodeDeviceCreate(virNodeDevice *device,
 
     virCheckFlags(0, -1);
 
+    if (nodeDeviceInitWait() < 0)
+        return -1;
+
     if (!(obj = nodeDeviceObjFindByName(device->name)))
         return -1;
 
-- 
2.26.3




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux