]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
cgroup_rm_file: don't delete the uncreated files
authorGao feng <gaofeng@cn.fujitsu.com>
Thu, 6 Dec 2012 06:38:57 +0000 (14:38 +0800)
committerTejun Heo <tj@kernel.org>
Thu, 6 Dec 2012 16:58:11 +0000 (08:58 -0800)
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
kernel/cgroup.c

index 5cc37241a6fb78851c65f51e2c87bf9b93afd0b6..f34c41bfaa37daa2b399c6387740d397703a277c 100644 (file)
@@ -2724,12 +2724,6 @@ static int cgroup_add_file(struct cgroup *cgrp, struct cgroup_subsys *subsys,
 
        simple_xattrs_init(&cft->xattrs);
 
-       /* does @cft->flags tell us to skip creation on @cgrp? */
-       if ((cft->flags & CFTYPE_NOT_ON_ROOT) && !cgrp->parent)
-               return 0;
-       if ((cft->flags & CFTYPE_ONLY_ON_ROOT) && cgrp->parent)
-               return 0;
-
        if (subsys && !test_bit(ROOT_NOPREFIX, &cgrp->root->flags)) {
                strcpy(name, subsys->name);
                strcat(name, ".");
@@ -2770,6 +2764,12 @@ static int cgroup_addrm_files(struct cgroup *cgrp, struct cgroup_subsys *subsys,
        int err, ret = 0;
 
        for (cft = cfts; cft->name[0] != '\0'; cft++) {
+               /* does cft->flags tell us to skip this file on @cgrp? */
+               if ((cft->flags & CFTYPE_NOT_ON_ROOT) && !cgrp->parent)
+                       continue;
+               if ((cft->flags & CFTYPE_ONLY_ON_ROOT) && cgrp->parent)
+                       continue;
+
                if (is_add)
                        err = cgroup_add_file(cgrp, subsys, cft);
                else