From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35ED8C4708C for ; Fri, 28 May 2021 12:45:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1601D611C2 for ; Fri, 28 May 2021 12:45:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235701AbhE1Mqq (ORCPT ); Fri, 28 May 2021 08:46:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233734AbhE1Mqi (ORCPT ); Fri, 28 May 2021 08:46:38 -0400 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E80B0C061574; Fri, 28 May 2021 05:45:03 -0700 (PDT) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmbqV-001sdQ-IQ; Fri, 28 May 2021 12:44:11 +0000 Date: Fri, 28 May 2021 12:44:11 +0000 From: Al Viro To: Jia He Cc: Linus Torvalds , Petr Mladek , Steven Rostedt , Sergey Senozhatsky , Andy Shevchenko , Rasmus Villemoes , Jonathan Corbet , Luca Coelho , Kalle Valo , "David S. Miller" , Jakub Kicinski , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Johannes Berg , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-s390@vger.kernel.org Subject: Re: [PATCH RFCv2 1/3] fs: introduce helper d_path_fast() Message-ID: References: <20210528113951.6225-1-justin.he@arm.com> <20210528113951.6225-2-justin.he@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210528113951.6225-2-justin.he@arm.com> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 28, 2021 at 07:39:49PM +0800, Jia He wrote: > +/** > + * d_path_fast - fast return the full path of a dentry without taking > + * any seqlock/spinlock. This helper is typical for debugging purpose > + */ > +char *d_path_fast(const struct path *path, char *buf, int buflen) > +{ > + struct path root; > + struct mount *mnt = real_mount(path->mnt); > + DECLARE_BUFFER(b, buf, buflen); > + > + rcu_read_lock(); > + get_fs_root_rcu(current->fs, &root); > + > + prepend(&b, "", 1); > + __prepend_path(path->dentry, mnt, &root, &b); > + rcu_read_unlock(); > + > + return extract_string(&b); > +} > +EXPORT_SYMBOL(d_path_fast); Umm... I'd suggest failing if __prepend_path() returns 3 (at least)...