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 in later patches.

Signed-off-by: Valeriy Vdovin <[email protected]>
Reviewed-by: Kirill Tkhai <[email protected]>
---
 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 b71d4ccb2f0c..946031fcb393 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -3823,7 +3823,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;
@@ -3865,6 +3865,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;
 }
@@ -3902,7 +3904,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);
-- 
2.27.0

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to