cgroup: fix cgroup_add_cftypes() error handling
authorTejun Heo <tj@kernel.org>
Fri, 28 Jun 2013 23:24:11 +0000 (16:24 -0700)
committerTejun Heo <tj@kernel.org>
Fri, 12 Jul 2013 19:34:01 +0000 (12:34 -0700)
commit9ccece80ae19ed42439fc0ced76858f189cd41e8
tree8bab4d142410db148b2a7cbb4029d3b8eb1ab29a
parentb1f28d3109349899e87377e89f9d8ab5bc95ec57
cgroup: fix cgroup_add_cftypes() error handling

cgroup_add_cftypes() uses cgroup_cfts_commit() to actually create the
files; however, both functions ignore actual file creation errors and
just assume success.  This can lead to, for example, blkio hierarchy
with some of the cgroups with only subset of interface files populated
after cfq-iosched is loaded under heavy memory pressure, which is
nasty.

This patch updates cgroup_cfts_commit() and cgroup_add_cftypes() to
guarantee that all files are created on success and no file is created
on failure.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
kernel/cgroup.c