Skip to content

Commit a8d55ff

Browse files
zq-david-wanghtejun
authored andcommitted
kernel/cgroup: cleanup cgroup_base_files when fail to add cgroup_psi_files
Even though css_clear_dir would be called to cleanup all existing cgroup files when css_populate_dir failed, reclaiming newly created cgroup files before css_populate_dir returns with failure makes code more consistent. Signed-off-by: David Wang <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 9f34c56 commit a8d55ff

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

kernel/cgroup/cgroup.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1744,8 +1744,11 @@ static int css_populate_dir(struct cgroup_subsys_state *css)
17441744
if (cgroup_psi_enabled()) {
17451745
ret = cgroup_addrm_files(css, cgrp,
17461746
cgroup_psi_files, true);
1747-
if (ret < 0)
1747+
if (ret < 0) {
1748+
cgroup_addrm_files(css, cgrp,
1749+
cgroup_base_files, false);
17481750
return ret;
1751+
}
17491752
}
17501753
} else {
17511754
ret = cgroup_addrm_files(css, cgrp,

0 commit comments

Comments
 (0)