Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1392374 > unrolled thread

Re: [PATCH 2/2] mountinfo: implement show_path for kernfs and cgroup

Started byTejun Heo <tj@kernel.org>
First post2016-05-02 18:40 +0200
Last post2016-05-02 18:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 2/2] mountinfo: implement show_path for kernfs and cgroup Tejun Heo <tj@kernel.org> - 2016-05-02 18:40 +0200

#1392374 — Re: [PATCH 2/2] mountinfo: implement show_path for kernfs and cgroup

FromTejun Heo <tj@kernel.org>
Date2016-05-02 18:40 +0200
SubjectRe: [PATCH 2/2] mountinfo: implement show_path for kernfs and cgroup
Message-ID<rup36-6RX-37@gated-at.bofh.it>
Hello,

On Sun, Apr 17, 2016 at 03:04:32PM -0500, serge.hallyn@ubuntu.com wrote:
> +static int cgroup_show_path(struct seq_file *sf, struct kernfs_node *kf_node,
> +			    struct kernfs_root *kf_root)
> +{
> +	int len = 0, ret = 0;
> +	char *buf = NULL;
> +	struct cgroup_namespace *ns = current->nsproxy->cgroup_ns;
> +	struct cgroup_root *kf_cgroot = cgroup_root_from_kf(kf_root);
> +	struct cgroup *ns_cgroup;
> +
> +	mutex_lock(&cgroup_mutex);
> +	spin_lock_bh(&css_set_lock);
> +	ns_cgroup = cset_cgroup_from_root(ns->root_cset, kf_cgroot);
> +	len = kernfs_path_from_node(kf_node, ns_cgroup->kn, NULL, 0);
> +	if (len > 0)
> +		buf = kmalloc(len + 1, GFP_ATOMIC);

Ugh... What's up with GFP_ATOMIC?  Just allocate maximum sized buffer
before grabbing any locks.

Thanks.

-- 
tejun

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web