On CentOS 6, udev_monitor_receive_device will block until the socket becomes
readable, udevEventHandleThread will hold the lock all the time and
udevEventHandleCallback hard to get the lock, will block the event poll.
To fix this, set dataReady to false after receive an udev event.
Signed-off-by: Bingsong Si <owen.si(a)ucloud.cn>
---
src/node_device/node_device_udev.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 22897591de..ce1101d7cc 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1616,6 +1616,7 @@ udevEventHandleThread(void *opaque ATTRIBUTE_UNUSED)
errno = 0;
device = udev_monitor_receive_device(priv->udev_monitor);
+ priv->dataReady = false;
virObjectUnlock(priv);
if (!device) {
@@ -1637,10 +1638,6 @@ udevEventHandleThread(void *opaque ATTRIBUTE_UNUSED)
return;
}
- virObjectLock(priv);
- priv->dataReady = false;
- virObjectUnlock(priv);
-
continue;
}
--
2.18.0