public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [PATCH cgroup/for-3.12 1/2] cgroup: fix subsystem file accesses on the root cgroup
Date: Mon, 19 Aug 2013 10:23:41 +0800	[thread overview]
Message-ID: <521181AD.7090700@huawei.com> (raw)
In-Reply-To: <20130815154236.GG14606-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>

> 105347ba5 ("cgroup: make cgroup_file_open() rcu_read_lock() around
> cgroup_css() and add cfent->css") added cfent->css to cache the
> associted cgroup_subsys_state across file operations.
> 
> A cfent is associated with single css throughout its lifetime and the
> origimal commit initialized the cache pointer during cgroup_add_file()
> and verified that it matches the actual one in cgroup_file_open().
> While this works fine for !root cgroups, it's broken for root cgroups
> as files in a root cgroup are created before the css's are associated
> with the cgroup and thus cgroup_css() call in cgroup_add_file()
> returns NULL associating all cfents in the root cgroup with NULL css.
> This makes cgroup_file_open() trigger WARN and fail with -ENODEV for
> all !core subsystem files in the root cgroups.
> 
> There's no reason to initialize cfent->css separately from
> cgroup_add_file().  As the association never changes,
> cgroup_file_open() can set it unconditionally every time and
> containing the logic in cgroup_file_open() makes more sense anyway as
> the only reason it's necessary is file->private_data being already
> occupied.
> 
> Fix it by setting cfent->css unconditionally from cgroup_file_open().
> 
> Signed-off-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

Acked-by: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>

  parent reply	other threads:[~2013-08-19  2:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-15 15:42 [PATCH cgroup/for-3.12 1/2] cgroup: fix subsystem file accesses on the root cgroup Tejun Heo
     [not found] ` <20130815154236.GG14606-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2013-08-15 15:43   ` [PATCH cgroup/for-3.12 2/2] cgroup: fix cgroup_write_event_control() Tejun Heo
     [not found]     ` <20130815154315.GH14606-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2013-08-19  2:41       ` Li Zefan
     [not found]         ` <521185F3.6060806-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-08-19 13:57           ` Tejun Heo
2013-08-19  2:23   ` Li Zefan [this message]
     [not found]     ` <521181AD.7090700-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-08-19 13:57       ` [PATCH cgroup/for-3.12 1/2] cgroup: fix subsystem file accesses on the root cgroup Tejun Heo

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=521181AD.7090700@huawei.com \
    --to=lizefan-hv44wf8li93qt0dzr+alfa@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox