[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160502163441.GV7822@mtj.duckdns.org>
Date: Mon, 2 May 2016 12:34:41 -0400
From: Tejun Heo <tj@...nel.org>
To: serge.hallyn@...ntu.com
Cc: linux-kernel@...r.kernel.org, adityakali@...gle.com,
linux-api@...r.kernel.org, containers@...ts.linux-foundation.org,
cgroups@...r.kernel.org, akpm@...ux-foundation.org,
ebiederm@...ssion.com, gregkh@...uxfoundation.org,
lizefan@...wei.com, hannes@...xchg.org
Subject: Re: [PATCH 2/2] mountinfo: implement show_path for kernfs and cgroup
Hello,
On Sun, Apr 17, 2016 at 03:04:32PM -0500, serge.hallyn@...ntu.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
Powered by blists - more mailing lists