[Devel] [PATCH rh7 v2] ve/kobj: Send events per VE instead of all net-namespaces broadcasting

Cyrill Gorcunov gorcunov at virtuozzo.com
Wed Jun 3 12:24:31 PDT 2015


Currently uevents are sending broadcastly to all net-namespaces present
in the system which is leading to problem of C/R'ing systemd based
containers (netlink socket sees data from the node and we can't dump
until the data is read). So lets send events broadcastly not per
net-namespace but per-VE.

Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
CC: Andrey Vagin <avagin at virtuozzo.com>
CC: Vladimir Davydov <vdavydov at virtuozzo.com>
CC: Konstantin Khorenko <khorenko at virtuozzo.com>
CC: Pavel Emelyanov <xemul at virtuozzo.com>
---
 lib/kobject_uevent.c     |    4 ++++
 net/core/net_namespace.c |    3 +++
 2 files changed, 7 insertions(+)

Index: linux-pcs7.git/lib/kobject_uevent.c
===================================================================
--- linux-pcs7.git.orig/lib/kobject_uevent.c
+++ linux-pcs7.git/lib/kobject_uevent.c
@@ -27,6 +27,7 @@
 #include <net/sock.h>
 #include <net/net_namespace.h>
 
+#include <linux/ve.h>
 
 u64 uevent_seqnum;
 char uevent_helper[UEVENT_HELPER_PATH_LEN] = CONFIG_UEVENT_HELPER_PATH;
@@ -262,6 +263,9 @@ int kobject_uevent_env_one(struct kobjec
 		if (!netlink_has_listeners(uevent_sock, 1))
 			continue;
 
+		if (sock_net(uevent_sock)->owner_ve != get_exec_env())
+			continue;
+
 		/* allocate message with the maximum possible size */
 		len = strlen(action_string) + strlen(devpath) + 2;
 		skb = alloc_skb(len + env->buflen, GFP_KERNEL);
Index: linux-pcs7.git/net/core/net_namespace.c
===================================================================
--- linux-pcs7.git.orig/net/core/net_namespace.c
+++ linux-pcs7.git/net/core/net_namespace.c
@@ -33,6 +33,9 @@ EXPORT_SYMBOL_GPL(net_namespace_list);
 
 struct net init_net = {
 	.dev_base_head = LIST_HEAD_INIT(init_net.dev_base_head),
+#ifdef CONFIG_VE
+	.owner_ve = &ve0,
+#endif
 };
 EXPORT_SYMBOL(init_net);
 



More information about the Devel mailing list