[Devel] [PATCH RH9 09/11] ve/kobj: Send events per VE instead of all net-namespaces broadcasting
Alexander Mikhalitsyn
alexander.mikhalitsyn at virtuozzo.com
Thu Sep 23 18:02:33 MSK 2021
From: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
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>
Rebased to RHEL8 beta kernel:
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
https://jira.sw.ru/browse/PSBM-133986
(cherry picked from commit 5cba05d6f334ac07ffdd9563ac9e2099477fe167)
Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn at virtuozzo.com>
---
lib/kobject_uevent.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index db150f72ba9a..08b56d8a1836 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -29,6 +29,7 @@
#include <net/netlink.h>
#include <net/net_namespace.h>
+#include <linux/ve.h>
u64 uevent_seqnum;
#ifdef CONFIG_UEVENT_HELPER
@@ -317,10 +318,15 @@ static int uevent_net_broadcast_untagged(struct kobj_uevent_env *env,
/* send netlink message */
list_for_each_entry(ue_sk, &uevent_sock_list, list) {
struct sock *uevent_sock = ue_sk->sk;
+ struct ve_struct *owner_ve;
if (!netlink_has_listeners(uevent_sock, 1))
continue;
+ owner_ve = sock_net(uevent_sock)->owner_ve;
+ if (!ve_is_super(owner_ve) && owner_ve != get_exec_env())
+ continue;
+
if (!skb) {
retval = -ENOMEM;
skb = alloc_uevent_skb(env, action_string, devpath);
@@ -347,6 +353,11 @@ static int uevent_net_broadcast_tagged(struct sock *usk,
struct user_namespace *owning_user_ns = sock_net(usk)->user_ns;
struct sk_buff *skb = NULL;
int ret = 0;
+ struct ve_struct *owner_ve;
+
+ owner_ve = sock_net(usk)->owner_ve;
+ if (!ve_is_super(owner_ve) && owner_ve != get_exec_env())
+ return -EINVAL;
skb = alloc_uevent_skb(env, action_string, devpath);
if (!skb)
--
2.31.1
More information about the Devel
mailing list