[Devel] [PATCH RHEL9 COMMIT] ve: use rcu_dereference for ve_ns in ve_get_init_css

Konstantin Khorenko khorenko at virtuozzo.com
Wed Oct 13 14:13:32 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 rh9-5.14.0-4.vz9.10.1
------>
commit fe5a9b228d84b824d82b7700cbbfd0322812ccbf
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Wed Oct 13 14:13:32 2021 +0300

    ve: use rcu_dereference for ve_ns in ve_get_init_css
    
    vz9 changes: drop css_local_root hunk as excess, we already have root ve
    cgroup from ve cgroup ns css set it's not connected with init task
    anymore after we've switched to cgroup namespaces; cleanup comments as
    unrelated and rename patch.
    
    https://jira.sw.ru/browse/PSBM-134002
    (cherry picked from vz8 commit c1b584c0d3bef695eef60841f22a2e6d90e23da4)
    Fixes: 87e54c0229a4 ("ve: Add ve cgroup and ve_hook subsys")
    Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 kernel/ve/ve.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 5acd2baa2a08..847179044066 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -282,7 +282,10 @@ struct cgroup_subsys_state *ve_get_init_css(struct ve_struct *ve, int subsys_id)
 
 	rcu_read_lock();
 
-	nsproxy = ve->ve_ns ? : &init_nsproxy;
+	nsproxy = rcu_dereference(ve->ve_ns);
+	if (!nsproxy)
+		nsproxy = &init_nsproxy;
+
 	root_cset = nsproxy->cgroup_ns->root_cset;
 	css = root_cset->subsys[subsys_id];
 	/* nsproxy->cgroup_ns must hold root_cset refcnt */


More information about the Devel mailing list