mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Li Zefan <lizefan@huawei.com>
Cc: containers@lists.linux-foundation.org, cgroups@vger.kernel.org,
	linux-kernel@vger.kernel.org, kay@vrfy.org, greg@kroah.com,
	lennart@poettering.net, daniel@zonque.org
Subject: Re: [PATCH 4/4] cgroup: implement task_cgroup_path_from_hierarchy()
Date: Sun, 14 Apr 2013 20:48:25 -0700	[thread overview]
Message-ID: <20130415034825.GL3050@htj.dyndns.org> (raw)
In-Reply-To: <20130415034613.GK3050@htj.dyndns.org>

On Sun, Apr 14, 2013 at 08:46:13PM -0700, Tejun Heo wrote:
> On Mon, Apr 15, 2013 at 11:43:15AM +0800, Li Zefan wrote:
> > > +int task_cgroup_path_from_hierarchy(struct task_struct *task, int hierarchy_id,
> > > +				    char *buf, size_t buflen)
> > > +{
> > > +	struct cgroupfs_root *root;
> > > +	struct cgroup *cgrp = NULL;
> > > +	int ret = -ENOENT;
> > > +
> > > +	mutex_lock(&cgroup_mutex);
> > > +
> > > +	root = idr_find(&cgroup_hierarchy_idr, hierarchy_id);
> > > +	if (root) {
> > > +		cgrp = task_cgroup_from_root(task, root);
> > 
> > task_cgroup_from_root() will never return NULL, and there's a BUG_ON(!res) in it.
> 
> @hierarchy_id may come from userland, so we probably should update
> task_cgroup_from_root() to return NULL if the id is invalid.  Will add
> a patch.

For some reason, I thought you were talking about hierarchy lookup.
Yeap, task_cgroup_from_root() can't be NULL for a valid hierarchy.
Will drop the if.

-- 
tejun

  reply	other threads:[~2013-04-15  3:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-14 18:36 [PATCHSET] " Tejun Heo
2013-04-14 18:36 ` [PATCH 1/4] cgroup: refactor hierarchy_id handling Tejun Heo
2013-04-14 18:36 ` [PATCH 2/4] cgroup: drop hierarchy_id_lock Tejun Heo
2013-04-14 18:36 ` [PATCH 3/4] cgroup: make hierarchy_id use cyclic idr Tejun Heo
2013-04-14 18:36 ` [PATCH 4/4] cgroup: implement task_cgroup_path_from_hierarchy() Tejun Heo
2013-04-14 19:16   ` Greg KH
2013-04-15  3:43   ` Li Zefan
2013-04-15  3:46     ` Tejun Heo
2013-04-15  3:48       ` Tejun Heo [this message]
2013-04-15  3:49       ` Li Zefan
2013-04-15  3:57         ` Tejun Heo
2013-04-15  3:50   ` [PATCH UPDATED " Tejun Heo
2013-04-15  3:22 ` [PATCHSET] " Tejun Heo
2013-04-15  3:43 ` Li Zefan
2013-05-14 18:45 ` 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=20130415034825.GL3050@htj.dyndns.org \
    --to=tj@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=containers@lists.linux-foundation.org \
    --cc=daniel@zonque.org \
    --cc=greg@kroah.com \
    --cc=kay@vrfy.org \
    --cc=lennart@poettering.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    /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

Powered by JetHome