diff options
author | Gao feng <gaofeng@cn.fujitsu.com> | 2012-12-06 01:38:57 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2012-12-06 11:58:11 -0500 |
commit | f33fddc2b9573d8359f1007d4bbe5cd587a0c093 (patch) | |
tree | a970a2cd9d59ed0bc80eea8e9392978c38517772 /kernel/cgroup.c | |
parent | 7083d0378a1746f2b45729cae494c6b92e75d73f (diff) |
cgroup_rm_file: don't delete the uncreated files
in cgroup_add_file,when creating files for cgroup,
some of creation may be skipped. So we need to avoid
deleting these uncreated files in cgroup_rm_file,
otherwise the warning msg will be triggered.
"cgroup_addrm_files: failed to remove memory_pressure_enabled, err=-2"
Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
Acked-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@redhat.com>
Cc: stable@vger.kernel.org
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r-- | kernel/cgroup.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 5cc37241a6fb..f34c41bfaa37 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -2724,12 +2724,6 @@ static int cgroup_add_file(struct cgroup *cgrp, struct cgroup_subsys *subsys, | |||
2724 | 2724 | ||
2725 | simple_xattrs_init(&cft->xattrs); | 2725 | simple_xattrs_init(&cft->xattrs); |
2726 | 2726 | ||
2727 | /* does @cft->flags tell us to skip creation on @cgrp? */ | ||
2728 | if ((cft->flags & CFTYPE_NOT_ON_ROOT) && !cgrp->parent) | ||
2729 | return 0; | ||
2730 | if ((cft->flags & CFTYPE_ONLY_ON_ROOT) && cgrp->parent) | ||
2731 | return 0; | ||
2732 | |||
2733 | if (subsys && !test_bit(ROOT_NOPREFIX, &cgrp->root->flags)) { | 2727 | if (subsys && !test_bit(ROOT_NOPREFIX, &cgrp->root->flags)) { |
2734 | strcpy(name, subsys->name); | 2728 | strcpy(name, subsys->name); |
2735 | strcat(name, "."); | 2729 | strcat(name, "."); |
@@ -2770,6 +2764,12 @@ static int cgroup_addrm_files(struct cgroup *cgrp, struct cgroup_subsys *subsys, | |||
2770 | int err, ret = 0; | 2764 | int err, ret = 0; |
2771 | 2765 | ||
2772 | for (cft = cfts; cft->name[0] != '\0'; cft++) { | 2766 | for (cft = cfts; cft->name[0] != '\0'; cft++) { |
2767 | /* does cft->flags tell us to skip this file on @cgrp? */ | ||
2768 | if ((cft->flags & CFTYPE_NOT_ON_ROOT) && !cgrp->parent) | ||
2769 | continue; | ||
2770 | if ((cft->flags & CFTYPE_ONLY_ON_ROOT) && cgrp->parent) | ||
2771 | continue; | ||
2772 | |||
2773 | if (is_add) | 2773 | if (is_add) |
2774 | err = cgroup_add_file(cgrp, subsys, cft); | 2774 | err = cgroup_add_file(cgrp, subsys, cft); |
2775 | else | 2775 | else |