linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cgroup: fix a failure path in create_css()
@ 2014-03-18  9:02 Li Zefan
  2014-03-18 15:24 ` Tejun Heo
  0 siblings, 1 reply; 4+ messages in thread
From: Li Zefan @ 2014-03-18  9:02 UTC (permalink / raw)
  To: Tejun Heo; +Cc: LKML, Cgroups

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

Signed-off-by: Li Zefan <lizefan@huawei.com>
---
 kernel/cgroup.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 3790617..e673407 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -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;
 }
-- 
1.8.0.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] cgroup: fix a failure path in create_css()
  2014-03-18  9:02 [PATCH] cgroup: fix a failure path in create_css() Li Zefan
@ 2014-03-18 15:24 ` Tejun Heo
  2014-03-18 16:12   ` Tejun Heo
  0 siblings, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2014-03-18 15:24 UTC (permalink / raw)
  To: Li Zefan; +Cc: LKML, Cgroups

On Tue, Mar 18, 2014 at 05:02:36PM +0800, Li Zefan wrote:
> If online_css() fails, we should remove cgroup files belonging
> to css->ss.
> 
> Signed-off-by: Li Zefan <lizefan@huawei.com>

Applied to libata/for-3.14-fixes.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cgroup: fix a failure path in create_css()
  2014-03-18 15:24 ` Tejun Heo
@ 2014-03-18 16:12   ` Tejun Heo
  2014-03-18 21:22     ` Tejun Heo
  0 siblings, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2014-03-18 16:12 UTC (permalink / raw)
  To: Li Zefan; +Cc: LKML, Cgroups

On Tue, Mar 18, 2014 at 11:24:45AM -0400, Tejun Heo wrote:
> On Tue, Mar 18, 2014 at 05:02:36PM +0800, Li Zefan wrote:
> > If online_css() fails, we should remove cgroup files belonging
> > to css->ss.
> > 
> > Signed-off-by: Li Zefan <lizefan@huawei.com>
> 
> 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.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cgroup: fix a failure path in create_css()
  2014-03-18 16:12   ` Tejun Heo
@ 2014-03-18 21:22     ` Tejun Heo
  0 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2014-03-18 21:22 UTC (permalink / raw)
  To: Li Zefan; +Cc: LKML, Cgroups

On Tue, Mar 18, 2014 at 12:12:25PM -0400, Tejun Heo wrote:
> On Tue, Mar 18, 2014 at 11:24:45AM -0400, Tejun Heo wrote:
> > On Tue, Mar 18, 2014 at 05:02:36PM +0800, Li Zefan wrote:
> > > If online_css() fails, we should remove cgroup files belonging
> > > to css->ss.
> > > 
> > > Signed-off-by: Li Zefan <lizefan@huawei.com>
> > 
> > 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.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-18 21:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-18  9:02 [PATCH] cgroup: fix a failure path in create_css() Li Zefan
2014-03-18 15:24 ` Tejun Heo
2014-03-18 16:12   ` Tejun Heo
2014-03-18 21:22     ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).