mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 06:50:22 +03:00
nodedev: udev: Hook up virFileWaitForExist to address uevent race of pci device
Similarly to commit 1af45804 we should be safer by waiting for the whole sysfs tree is created for the device. Signed-off-by: Guoyi Tu <tugy@chinatelecom.cn> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
946b81a2e9
commit
8a92493596
@ -427,10 +427,19 @@ udevProcessPCI(virNodeDeviceDriverState *driver_state,
|
||||
virPCIEDeviceInfo *pci_express = NULL;
|
||||
virPCIDevice *pciDev = NULL;
|
||||
virPCIDeviceAddress devAddr = { 0 };
|
||||
g_autofree char *linkpath = NULL;
|
||||
int ret = -1;
|
||||
char *p;
|
||||
bool privileged = false;
|
||||
|
||||
linkpath = g_strdup_printf("%s/config", udev_device_get_syspath(device));
|
||||
if (virFileWaitForExists(linkpath, 10, 100) < 0) {
|
||||
virReportSystemError(errno,
|
||||
_("failed to wait for file '%1$s' to appear"),
|
||||
linkpath);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
VIR_WITH_MUTEX_LOCK_GUARD(&driver_state->lock) {
|
||||
privileged = driver_state->privileged;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user