public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Li Zefan <lizefan@huawei.com>
Cc: "Toralf Förster" <toralf.foerster@gmx.de>,
	LKML <linux-kernel@vger.kernel.org>,
	Cgroups <cgroups@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] cgroup: check cgroup liveliness before unbreaking kernfs
Date: Fri, 5 Sep 2014 01:38:40 +0900	[thread overview]
Message-ID: <20140904163840.GA26364@mtj.dyndns.org> (raw)
In-Reply-To: <54080A1A.7070207@huawei.com>

On Thu, Sep 04, 2014 at 02:43:38PM +0800, Li Zefan wrote:
> When cgroup_kn_lock_live() is called through some kernfs operation and
> another thread is calling cgroup_rmdir(), we'll trigger the warning in
> cgroup_get().
> 
> ------------[ cut here ]------------
> WARNING: CPU: 1 PID: 1228 at kernel/cgroup.c:1034 cgroup_get+0x89/0xa0()
> ...
> Call Trace:
>  [<c16ee73d>] dump_stack+0x41/0x52
>  [<c10468ef>] warn_slowpath_common+0x7f/0xa0
>  [<c104692d>] warn_slowpath_null+0x1d/0x20
>  [<c10bb999>] cgroup_get+0x89/0xa0
>  [<c10bbe58>] cgroup_kn_lock_live+0x28/0x70
>  [<c10be3c1>] __cgroup_procs_write.isra.26+0x51/0x230
>  [<c10be5b2>] cgroup_tasks_write+0x12/0x20
>  [<c10bb7b0>] cgroup_file_write+0x40/0x130
>  [<c11aee71>] kernfs_fop_write+0xd1/0x160
>  [<c1148e58>] vfs_write+0x98/0x1e0
>  [<c114934d>] SyS_write+0x4d/0xa0
>  [<c16f656b>] sysenter_do_call+0x12/0x12
> ---[ end trace 6f2e0c38c2108a74 ]---
> 
> Fix this by calling css_tryget() instead of cgroup_get().
> 
> v2:
> - move cgroup_tryget() right below cgroup_get() definition. (Tejun)
> 
> Cc: <stable@vger.kernel.org> # 3.15+
> Reported-by: Toralf Förster <toralf.foerster@gmx.de>
> Signed-off-by: Zefan Li <lizefan@huawei.com>

Applied 1-2 to cgroup/for-3.17-fixes.

Thanks.

-- 
tejun

      reply	other threads:[~2014-09-04 16:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-04  6:43 [PATCH v2 1/2] cgroup: delay the clearing of cgrp->kn->priv Li Zefan
     [not found] ` <540809FB.8020901-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-09-04  6:43   ` [PATCH v2 2/2] cgroup: check cgroup liveliness before unbreaking kernfs Li Zefan
2014-09-04 16:38     ` Tejun Heo [this message]

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=20140904163840.GA26364@mtj.dyndns.org \
    --to=tj@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=toralf.foerster@gmx.de \
    /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