[Devel] [PATCH RHEL7 COMMIT] ve/kobj: Send events per VE instead of all net-namespaces broadcasting
Konstantin Khorenko
khorenko at virtuozzo.com
Tue Jun 9 02:27:46 PDT 2015
The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.11
------>
commit 9b6abc191188f227a19f0404e2709fe421d779a8
Author: Cyrill Gorcunov <gorcunov at virtuozzo.com>
Date: Tue Jun 9 13:27:46 2015 +0400
ve/kobj: Send events per VE instead of all net-namespaces broadcasting
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 let's send broadcast events to net namespaces of the particular VE only.
Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
Acked-by: 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(+)
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 08da611..2ef1e15 100644
--- a/lib/kobject_uevent.c
+++ b/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 kobject *kobj, enum kobject_action action,
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);
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 7a7a989..0ad9aa1 100644
--- a/net/core/net_namespace.c
+++ b/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