[Devel] [PATCH RHEL9 COMMIT] cgroup/cfs: added 'activate' option to cgroup_add_file

Konstantin Khorenko khorenko at virtuozzo.com
Wed Oct 20 11:43:54 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.12
------>
commit ef5480be4d18b212b6c88f44aae3b60a0d80a0d6
Author: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>
Date:   Wed Oct 20 11:43:54 2021 +0300

    cgroup/cfs: added 'activate' option to cgroup_add_file
    
    In kernfs files get created in 'deactivated' state, which means they are
    not visible. Add option to activate the file after creation immediately
    making it visible in the parent directory. Will be used when adding
    release agent files to ve cgroup roots.
    
    Signed-off-by: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>
    
    vz9 change: cleanup commit message
    
    https://jira.sw.ru/browse/PSBM-134002
    (cherry picked from vz8 commit 53fae899bb7e04cbe8ba229c4e2134c8688e65bf)
    Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
    
    Reviewed-by: Alexander Mikhalitsyn <alexander.mikhalitsyn at virtuozzo.com>
    Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 kernel/cgroup/cgroup.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index c64797ecd49a..ff9f5b9dc219 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -4188,7 +4188,7 @@ static void cgroup_file_notify_timer(struct timer_list *timer)
 }
 
 static int cgroup_add_file(struct cgroup_subsys_state *css, struct cgroup *cgrp,
-			   struct cftype *cft)
+			   struct cftype *cft, bool activate)
 {
 	char name[CGROUP_FILE_NAME_MAX];
 	struct kernfs_node *kn;
@@ -4230,6 +4230,8 @@ static int cgroup_add_file(struct cgroup_subsys_state *css, struct cgroup *cgrp,
 		if (IS_ERR(kn_link))
 			return PTR_ERR(kn_link);
 	}
+	if (activate)
+		kernfs_activate(kn);
 
 	return 0;
 }
@@ -4269,7 +4271,7 @@ static int cgroup_addrm_files(struct cgroup_subsys_state *css,
 		if ((cft->flags & CFTYPE_DEBUG) && !cgroup_debug)
 			continue;
 		if (is_add) {
-			ret = cgroup_add_file(css, cgrp, cft);
+			ret = cgroup_add_file(css, cgrp, cft, false);
 			if (ret) {
 				pr_warn("%s: failed to add %s, err=%d\n",
 					__func__, cft->name, ret);


More information about the Devel mailing list