Skip to contentSkip to conversation

cgroup: fix a failure path in create_css()

PATCH Applied Li Zefan 2 participants 4 messages Mar 18, 2014 cgroup

lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/1 cgroup: fix a failure path in create_css()

If online_css() fails, we should remove cgroup files belonging to css->ss.

---
 kernel/cgroup.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
kernel/cgroup.c +7 -4
index 3790617..e673407 100644
@@ -3408,17 +3408,17 @@ static int create_css(struct cgroup *cgrp, struct cgroup_subsys *ss)
 
 	err = percpu_ref_init(&css->refcnt, css_release);
 	if (err)
-		goto err_free;
+		goto err_free_css;
 
 	init_css(css, ss, cgrp);
 
 	err = cgroup_populate_dir(cgrp, 1 << ss->id);
 	if (err)
-		goto err_free;
+		goto err_free_percpu_ref;
 
 	err = online_css(css);
 	if (err)
-		goto err_free;
+		goto err_clear_dir;
 
 	cgroup_get(cgrp);
 	css_get(css->parent);
@@ -3434,8 +3434,11 @@ static int create_css(struct cgroup *cgrp, struct cgroup_subsys *ss)
 
 	return 0;
 
-err_free:
+err_clear_dir:
+	cgroup_clear_dir(css->cgroup, 1 << css->ss->id);
+err_free_percpu_ref:
 	percpu_ref_cancel_init(&css->refcnt);
+err_free_css:
 	ss->css_free(css);
 	return err;
 }
Signature · 1 line
1.8.0.2
maintainer Applied
#1 lore raw
Quoted 4 lines · Li Zefan

If online_css() fails, we should remove cgroup files belonging to css->ss.

Applied to libata/for-3.14-fixes.

Thanks.

Signature · 1 line
tejun
maintainer
#2 lore raw
Quoted 7 lines · Tejun Heo
Quoted 4 lines · Li Zefan

If online_css() fails, we should remove cgroup files belonging to css->ss.

Applied to libata/for-3.14-fixes.

Hmmm... didn't apply cleanly and generated build error. Looks like the patch was generated against for-3.15. Can you please regenerate the patch against for-3.14-fixes?

Thanks.

Signature · 1 line
tejun
maintainer
#3 lore raw
Quoted 5 lines · Tejun Heo
Quoted 4 lines · Tejun Heo
Quoted 3 lines · Li Zefan

If online_css() fails, we should remove cgroup files belonging to css->ss.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Applied to libata/for-3.14-fixes.

Hmmm... didn't apply cleanly and generated build error. Looks like the patch was generated against for-3.15. Can you please regenerate the patch against for-3.14-fixes?

Never mind. Fixed up and applied to for-3.14-fixes.

Thanks.

Signature · 1 line
tejun