Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932989AbbLWQI7 (ORCPT ); Wed, 23 Dec 2015 11:08:59 -0500 Received: from mail-yk0-f177.google.com ([209.85.160.177]:36799 "EHLO mail-yk0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751536AbbLWQIz (ORCPT ); Wed, 23 Dec 2015 11:08:55 -0500 Date: Wed, 23 Dec 2015 11:08:54 -0500 From: Tejun Heo To: serge.hallyn@ubuntu.com Cc: linux-kernel@vger.kernel.org, adityakali@google.com, linux-api@vger.kernel.org, containers@lists.linux-foundation.org, cgroups@vger.kernel.org, lxc-devel@lists.linuxcontainers.org, akpm@linux-foundation.org, ebiederm@xmission.com, gregkh@linuxfoundation.org, lizefan@huawei.com, hannes@cmpxchg.org, "Serge E. Hallyn" Subject: Re: [PATCH 1/8] kernfs: Add API to generate relative kernfs path Message-ID: <20151223160854.GF5003@mtj.duckdns.org> References: <1450844609-9194-1-git-send-email-serge.hallyn@ubuntu.com> <1450844609-9194-2-git-send-email-serge.hallyn@ubuntu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1450844609-9194-2-git-send-email-serge.hallyn@ubuntu.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1278 Lines: 46 Hello, Serge. On Tue, Dec 22, 2015 at 10:23:22PM -0600, serge.hallyn@ubuntu.com wrote: > @@ -164,18 +286,39 @@ void pr_cont_kernfs_name(struct kernfs_node *kn) > void pr_cont_kernfs_path(struct kernfs_node *kn) > { > unsigned long flags; > - char *p; > + char *p = NULL; > + int sz1, sz2; > > spin_lock_irqsave(&kernfs_rename_lock, flags); > > - p = kernfs_path_locked(kn, kernfs_pr_cont_buf, > - sizeof(kernfs_pr_cont_buf)); > - if (p) > - pr_cont("%s", p); > - else > - pr_cont(""); > + sz1 = kernfs_path_from_node_locked(kn, NULL, kernfs_pr_cont_buf, > + sizeof(kernfs_pr_cont_buf)); > + if (sz1 < 0) { > + pr_cont("(error)"); > + goto out; > + } > + > + if (sz1 < sizeof(kernfs_pr_cont_buf)) { > + pr_cont("%s", kernfs_pr_cont_buf); > + goto out; > + } > + > + p = kmalloc(sz1 + 1, GFP_NOFS); We can't do GFP_NOFS allocation while holding a spinlock and we don't want to do atomic allocation here either. I think it'd be best to keep using the static buffer. Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/