[Devel] [PATCH RHEL COMMIT] ve/uevent: Use own uevent_seqnum for every VE

Konstantin Khorenko khorenko at virtuozzo.com
Fri Sep 24 14:56:34 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after ark-5.14
------>
commit 10f2e4f0d7faf021b33a867e2f7ab93060b66cb5
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Fri Sep 24 14:56:33 2021 +0300

    ve/uevent: Use own uevent_seqnum for every VE
    
    https://jira.sw.ru/browse/PSBM-17903
    
    Signed-off-by: Kirill Tkhai <ktkhai at parallels.com>
    
    https://jira.sw.ru/browse/PSBM-133986
    
    (cherry picked from commit 739915b241c792831b89f87bb6260da8a6a515e7)
    Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn at virtuozzo.com>
---
 include/linux/ve.h   | 6 ++++++
 kernel/ksysfs.c      | 3 ++-
 lib/kobject_uevent.c | 2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/linux/ve.h b/include/linux/ve.h
index 8463a826b5b6..fa7323272deb 100644
--- a/include/linux/ve.h
+++ b/include/linux/ve.h
@@ -53,6 +53,8 @@ struct ve_struct {
 	atomic_t		netns_avail_nr;
 	int			netns_max_nr;
 
+	u64			_uevent_seqnum;
+
 	int			_randomize_va_space;
 };
 
@@ -85,6 +87,8 @@ struct user_namespace *ve_init_user_ns(void);
 
 extern struct cgroup *cgroup_get_ve_root1(struct cgroup *cgrp);
 
+#define ve_uevent_seqnum       (get_exec_env()->_uevent_seqnum)
+
 #else	/* CONFIG_VE */
 #define get_ve(ve)	(NULL)
 #define put_ve(ve)	do { } while (0)
@@ -108,6 +112,8 @@ static inline struct cgroup *cgroup_get_ve_root1(struct cgroup *cgrp)
 {
 	return NULL;
 }
+#define ve_uevent_seqnum uevent_seqnum
+
 #endif	/* CONFIG_VE */
 
 #endif /* _LINUX_VE_H */
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
index 35859da8bd4f..e56c431b94af 100644
--- a/kernel/ksysfs.c
+++ b/kernel/ksysfs.c
@@ -17,6 +17,7 @@
 #include <linux/sched.h>
 #include <linux/capability.h>
 #include <linux/compiler.h>
+#include <linux/ve.h>
 
 #include <linux/rcupdate.h>	/* rcu_expedited and rcu_normal */
 
@@ -31,7 +32,7 @@ static struct kobj_attribute _name##_attr = \
 static ssize_t uevent_seqnum_show(struct kobject *kobj,
 				  struct kobj_attribute *attr, char *buf)
 {
-	return sprintf(buf, "%llu\n", (unsigned long long)uevent_seqnum);
+	return sprintf(buf, "%llu\n", (unsigned long long)ve_uevent_seqnum);
 }
 KERNEL_ATTR_RO(uevent_seqnum);
 
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index c87d5b6a8a55..db150f72ba9a 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -585,7 +585,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
 
 	mutex_lock(&uevent_sock_mutex);
 	/* we will send an event, so request a new sequence number */
-	retval = add_uevent_var(env, "SEQNUM=%llu", ++uevent_seqnum);
+	retval = add_uevent_var(env, "SEQNUM=%llu", ++ve_uevent_seqnum);
 	if (retval) {
 		mutex_unlock(&uevent_sock_mutex);
 		goto exit;


More information about the Devel mailing list