diff --git a/kernel/cgroup.c b/kernel/cgroup.c index df8fb82ef350..66c1e3b5c0f2 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -3732,13 +3732,13 @@ static struct cftype files[] = { .read_u64 = cgroup_clone_children_read, .write_u64 = cgroup_clone_children_write, }, -}; - -static struct cftype cft_release_agent = { - .name = "release_agent", - .read_seq_string = cgroup_release_agent_show, - .write_string = cgroup_release_agent_write, - .max_write_len = PATH_MAX, + { + .name = "release_agent", + .flags = CFTYPE_ONLY_ON_ROOT, + .read_seq_string = cgroup_release_agent_show, + .write_string = cgroup_release_agent_write, + .max_write_len = PATH_MAX, + }, }; static int cgroup_populate_dir(struct cgroup *cgrp) @@ -3750,11 +3750,6 @@ static int cgroup_populate_dir(struct cgroup *cgrp) if (err < 0) return err; - if (cgrp == cgrp->top_cgroup) { - if ((err = cgroup_add_file(cgrp, NULL, &cft_release_agent)) < 0) - return err; - } - /* process cftsets of each subsystem */ for_each_subsys(cgrp->root, ss) { struct cftype_set *set;