[Devel] [RFC] Separate uevents delivery
Cyrill Gorcunov
gorcunov at virtuozzo.com
Tue Jun 2 10:49:30 PDT 2015
Guys, could you please take a look once time permit,
does the patch looks sane? The idea behind is to deliver
uevents per VE, not per all net namespaces (moreover we
allow nested net namespaces). It looks like I'm missing
something here, would the construction below fit the
requirement? (with the patch I no longer get queued data
in netlink socket but I suspect there is some bug in
the patch)
---
lib/kobject_uevent.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
Index: linux-pcs7.git/lib/kobject_uevent.c
===================================================================
--- linux-pcs7.git.orig/lib/kobject_uevent.c
+++ linux-pcs7.git/lib/kobject_uevent.c
@@ -118,6 +118,21 @@ static int kobj_usermode_filter(struct k
return 0;
}
+#ifdef CONFIG_VE
+static bool ve_kobj_may_send_uevent(const struct net *dst)
+{
+ struct ve_struct *ve = get_exec_env();
+
+ if (!ve->ve_netns)
+ return ve_is_super(ve) ? true : false;
+
+ if (dst->owner_ve != ve)
+ return false;
+
+ return true;
+}
+#endif
+
/**
* kobject_uevent_env - send an uevent with environmental data
*
@@ -262,6 +277,11 @@ int kobject_uevent_env_one(struct kobjec
if (!netlink_has_listeners(uevent_sock, 1))
continue;
+#ifdef CONFIG_VE
+ if (!ve_kobj_may_send_uevent(sock_net(uevent_sock)))
+ continue;
+#endif
+
/* allocate message with the maximum possible size */
len = strlen(action_string) + strlen(devpath) + 2;
skb = alloc_skb(len + env->buflen, GFP_KERNEL);
More information about the Devel
mailing list