render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
3e5111
From c0b489c317a0cd3b709008d742d6653634455ded Mon Sep 17 00:00:00 2001
3e5111
Message-Id: <c0b489c317a0cd3b709008d742d6653634455ded@dist-git>
3e5111
From: "ning.bo" <ning.bo9@zte.com.cn>
3e5111
Date: Mon, 29 May 2017 16:22:50 +0200
3e5111
Subject: [PATCH] nodedev: Increase the netlink socket buffer size to the one
3e5111
 used by udev
3e5111
3e5111
When a number of SRIOV VFs (up to 128 on Intel XL710) is created:
3e5111
for i in `seq 0 1`; do
3e5111
  echo 63 > /sys/class/net/<interface>/device/sriov_numvfs
3e5111
done
3e5111
3e5111
libvirtd will then report "udev_monitor_receive_device returned NULL"
3e5111
error because the netlink socket buffer is not big enough (using GDB on
3e5111
libudev confirmed this with ENOBUFFS) and thus some udev events were
3e5111
dropped. This results in some devices being missing in the nodedev-list
3e5111
output. This patch overrides the system's rmem_max limit but for that,
3e5111
we need to make sure we've got root privileges.
3e5111
3e5111
https://bugzilla.redhat.com/show_bug.cgi?id=1450960
3e5111
3e5111
Signed-off-by: ning.bo <ning.bo9@zte.com.cn>
3e5111
Signed-off-by: Erik Skultety <eskultet@redhat.com>
3e5111
(cherry picked from commit d1eea6c12aad5cb503562a52915138bf0d0a70a2)
3e5111
3e5111
https://bugzilla.redhat.com/show_bug.cgi?id=1442307
3e5111
Signed-off-by: Erik Skultety <eskultet@redhat.com>
3e5111
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3e5111
---
3e5111
 src/node_device/node_device_udev.c | 7 +++++++
3e5111
 1 file changed, 7 insertions(+)
3e5111
3e5111
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
3e5111
index 37528ee48..20c0fc837 100644
3e5111
--- a/src/node_device/node_device_udev.c
3e5111
+++ b/src/node_device/node_device_udev.c
3e5111
@@ -1732,6 +1732,13 @@ static int nodeStateInitialize(bool privileged,
3e5111
 
3e5111
     udev_monitor_enable_receiving(priv->udev_monitor);
3e5111
 
3e5111
+    /* mimic udevd's behaviour and override the systems rmem_max limit in case
3e5111
+     * there's a significant number of device 'add' events
3e5111
+     */
3e5111
+    if (geteuid() == 0)
3e5111
+        udev_monitor_set_receive_buffer_size(priv->udev_monitor,
3e5111
+                                             128 * 1024 * 1024);
3e5111
+
3e5111
     /* We register the monitor with the event callback so we are
3e5111
      * notified by udev of device changes before we enumerate existing
3e5111
      * devices because libvirt will simply recreate the device if we
3e5111
-- 
3e5111
2.13.0
3e5111