All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
To: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devel-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org,
	Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH] cgroup: fix fail path in cgroup_load_subsys()
Date: Thu, 12 Dec 2013 22:37:32 +0400	[thread overview]
Message-ID: <52AA026C.3040605@parallels.com> (raw)
In-Reply-To: <20131212155523.GF32683-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>

On 12/12/2013 07:55 PM, Tejun Heo wrote:
> On Thu, Dec 12, 2013 at 10:35:36AM -0500, Tejun Heo wrote:
>> On Sat, Dec 07, 2013 at 11:58:05AM +0400, Vladimir Davydov wrote:
>>> We should not call cgroup_unload_subsys() if online_css() fails, because
>>> online_css() does not assign css to cgroup on failure, while
>>> offline_css() called from cgroup_unload_subsys() expects it is assigned.
>>> So let's call everything we need to rollback inline without involving
>>> cgroup_unload_subsys().
>>>
>>> Signed-off-by: Vladimir Davydov <vdavydov-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
>>> Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
>>> Cc: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
>> Applied to cgroup/for-3.13-fixes.
> Scrap that.  I don't think we can fail css_online for the root css in
> 3.13-fixes and this would cause conflict with 3.14, so let's not
> commit it to 3.13-fixes.  Vladimir, can you please respin the patch on
> top of cgroup/for-3.14

No problem.

> but make cgroup_unload_subsys() check whether
> css is actually there before calling offline so that it matches the
> usual offline path better?

You want me to add something like this to the patch, don't you?

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 402f7aa..bc03b97 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4680,6 +4680,7 @@ EXPORT_SYMBOL_GPL(cgroup_load_subsys);
 void cgroup_unload_subsys(struct cgroup_subsys *ss)
 {
     struct cgrp_cset_link *link;
+    struct cgroup_subsys_state *css;
 
     BUG_ON(ss->module == NULL);
 
@@ -4693,7 +4694,9 @@ void cgroup_unload_subsys(struct cgroup_subsys *ss)
     mutex_lock(&cgroup_mutex);
     mutex_lock(&cgroup_root_mutex);
 
-    offline_css(cgroup_css(cgroup_dummy_top, ss));
+    css = cgroup_css(cgroup_dummy_top, ss);
+    if (css)
+        offline_css(css);
 
     /* deassign the subsys_id */
     cgroup_subsys[ss->subsys_id] = NULL;


If so, I don't mind, but why? cgroup_unload_subsys() should never be
called without properly initialized css.

Thanks.

WARNING: multiple messages have this Message-ID (diff)
From: Vladimir Davydov <vdavydov@parallels.com>
To: Tejun Heo <tj@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <cgroups@vger.kernel.org>,
	<devel@openvz.org>, Li Zefan <lizefan@huawei.com>
Subject: Re: [PATCH] cgroup: fix fail path in cgroup_load_subsys()
Date: Thu, 12 Dec 2013 22:37:32 +0400	[thread overview]
Message-ID: <52AA026C.3040605@parallels.com> (raw)
In-Reply-To: <20131212155523.GF32683@htj.dyndns.org>

On 12/12/2013 07:55 PM, Tejun Heo wrote:
> On Thu, Dec 12, 2013 at 10:35:36AM -0500, Tejun Heo wrote:
>> On Sat, Dec 07, 2013 at 11:58:05AM +0400, Vladimir Davydov wrote:
>>> We should not call cgroup_unload_subsys() if online_css() fails, because
>>> online_css() does not assign css to cgroup on failure, while
>>> offline_css() called from cgroup_unload_subsys() expects it is assigned.
>>> So let's call everything we need to rollback inline without involving
>>> cgroup_unload_subsys().
>>>
>>> Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
>>> Cc: Tejun Heo <tj@kernel.org>
>>> Cc: Li Zefan <lizefan@huawei.com>
>> Applied to cgroup/for-3.13-fixes.
> Scrap that.  I don't think we can fail css_online for the root css in
> 3.13-fixes and this would cause conflict with 3.14, so let's not
> commit it to 3.13-fixes.  Vladimir, can you please respin the patch on
> top of cgroup/for-3.14

No problem.

> but make cgroup_unload_subsys() check whether
> css is actually there before calling offline so that it matches the
> usual offline path better?

You want me to add something like this to the patch, don't you?

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 402f7aa..bc03b97 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4680,6 +4680,7 @@ EXPORT_SYMBOL_GPL(cgroup_load_subsys);
 void cgroup_unload_subsys(struct cgroup_subsys *ss)
 {
     struct cgrp_cset_link *link;
+    struct cgroup_subsys_state *css;
 
     BUG_ON(ss->module == NULL);
 
@@ -4693,7 +4694,9 @@ void cgroup_unload_subsys(struct cgroup_subsys *ss)
     mutex_lock(&cgroup_mutex);
     mutex_lock(&cgroup_root_mutex);
 
-    offline_css(cgroup_css(cgroup_dummy_top, ss));
+    css = cgroup_css(cgroup_dummy_top, ss);
+    if (css)
+        offline_css(css);
 
     /* deassign the subsys_id */
     cgroup_subsys[ss->subsys_id] = NULL;


If so, I don't mind, but why? cgroup_unload_subsys() should never be
called without properly initialized css.

Thanks.

  parent reply	other threads:[~2013-12-12 18:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-07  7:58 [PATCH] cgroup: fix fail path in cgroup_load_subsys() Vladimir Davydov
2013-12-07  7:58 ` Vladimir Davydov
     [not found] ` <1386403085-24866-1-git-send-email-vdavydov-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-12-12  6:01   ` Li Zefan
2013-12-12  6:01     ` Li Zefan
2013-12-12 15:35   ` Tejun Heo
2013-12-12 15:35     ` Tejun Heo
     [not found]     ` <20131212153536.GD32683-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2013-12-12 15:55       ` Tejun Heo
2013-12-12 15:55         ` Tejun Heo
     [not found]         ` <20131212155523.GF32683-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2013-12-12 18:37           ` Vladimir Davydov [this message]
2013-12-12 18:37             ` Vladimir Davydov
     [not found]             ` <52AA026C.3040605-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-12-12 18:45               ` Tejun Heo
2013-12-12 18:45                 ` Tejun Heo
     [not found]                 ` <20131212184506.GK32683-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2013-12-12 18:51                   ` Vladimir Davydov
2013-12-12 18:51                     ` Vladimir Davydov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52AA026C.3040605@parallels.com \
    --to=vdavydov-bzqdu9zft3wakbo8gow8eq@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=devel-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.