From patchwork Mon Jul 4 23:15:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 12905873 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81B21C43334 for ; Mon, 4 Jul 2022 23:16:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 219456B0073; Mon, 4 Jul 2022 19:16:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CA9E6B0074; Mon, 4 Jul 2022 19:16:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B8816B0075; Mon, 4 Jul 2022 19:16:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id F33C16B0073 for ; Mon, 4 Jul 2022 19:16:15 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C4BF120B1E for ; Mon, 4 Jul 2022 23:16:15 +0000 (UTC) X-FDA: 79650977910.25.9704AD7 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) by imf21.hostedemail.com (Postfix) with ESMTP id 7DC671C0020 for ; Mon, 4 Jul 2022 23:16:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=pcS1G1OlD4As8AY5pL4+nnYUmzJ1Ij+cKL5OnlOGDmU=; b=cKBVkMzKga1zgdYpuIgEZr2KWm zjdiJ7f7CS9ldtxwhWWtw4sihmhQKxN5emZRaBS9jz9oA3R3eb4Fkn0a0W33nox7HdYLnDlUNr/6G Psnqt1jJ8P5QR61stJ3JMV8J8BK6v09kWn53QEem/iwCdtQiK8SOAE0JzlGgKcZhUucgh27Oiu7lz aEeRATnReUfEXNbJCvaw+b5VGNUQFSxoZFQlWyltWhQes+GKvAzBug15ufyERHzOHgL+7gmZiv59Z 2NWA0siXYeeg03JY0lQiaEsGbaLecHbXYmxqaMIr48HJBBZzYvvCg2gGkGNKVjtlMc1NlrTtY5p/c WxOle0Wg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.95 #2 (Red Hat Linux)) id 1o8VI2-008AZ2-Rt; Mon, 04 Jul 2022 23:15:38 +0000 Date: Tue, 5 Jul 2022 00:15:38 +0100 From: Al Viro To: Linus Torvalds Cc: Alexander Potapenko , Alexei Starovoitov , Andrew Morton , Andrey Konovalov , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Christoph Hellwig , Christoph Lameter , David Rientjes , Dmitry Vyukov , Eric Dumazet , Greg Kroah-Hartman , Herbert Xu , Ilya Leoshkevich , Ingo Molnar , Jens Axboe , Joonsoo Kim , Kees Cook , Marco Elver , Mark Rutland , Matthew Wilcox , "Michael S. Tsirkin" , Pekka Enberg , Peter Zijlstra , Petr Mladek , Steven Rostedt , Thomas Gleixner , Vasily Gorbik , Vegard Nossum , Vlastimil Babka , kasan-dev , Linux-MM , linux-arch , Linux Kernel Mailing List , Evgenii Stepanov , Nathan Chancellor , Nick Desaulniers , Segher Boessenkool , Vitaly Buka , linux-toolchains Subject: [PATCH 5/7] follow_dotdot{,_rcu}(): don't bother with inode Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656976575; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pcS1G1OlD4As8AY5pL4+nnYUmzJ1Ij+cKL5OnlOGDmU=; b=5FgE46YYyKiQoqrPYytoq6shHGwDItBwbIdeOboS0e4Ey1bjrmaFqmTqgBCaf9k1MocVBp cKsONm6Vh46xBJXocqgnDO6AULJocMcOKmWhnTPt5YOIUnu8vOAHRXgJKieZ3pVunAxHE9 //95wznmo+CUOx33hLPCVPIfsoatvN4= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=linux.org.uk header.s=zeniv-20220401 header.b=cKBVkMzK; spf=none (imf21.hostedemail.com: domain of viro@ftp.linux.org.uk has no SPF policy when checking 62.89.141.173) smtp.mailfrom=viro@ftp.linux.org.uk; dmarc=pass (policy=none) header.from=zeniv.linux.org.uk ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656976575; a=rsa-sha256; cv=none; b=bWyNMK4bTiuHe8PL3IME0Xw1c5uSFJrApkiCZ7eE5QaEUBmTw06cDhmzMk24t/UMt1L2vK Up2QvYJmjadFnrE7ErPqICcUBegWI3EBMdVvHhlnWHgJVeuu1gNveGmdJZKox/wD2f+ngV 4StLglkIKfaY0b5tukupVqSheJBjSB8= X-Stat-Signature: ownsqer6ehruatoitt8qdkqjpma8na1j X-Rspamd-Queue-Id: 7DC671C0020 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=linux.org.uk header.s=zeniv-20220401 header.b=cKBVkMzK; spf=none (imf21.hostedemail.com: domain of viro@ftp.linux.org.uk has no SPF policy when checking 62.89.141.173) smtp.mailfrom=viro@ftp.linux.org.uk; dmarc=pass (policy=none) header.from=zeniv.linux.org.uk X-Rspam-User: X-Rspamd-Server: rspam02 X-HE-Tag: 1656976575-358051 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: step_into() will fetch it, TYVM. Signed-off-by: Al Viro --- fs/namei.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index dddbebf92b48..fe95fe39634c 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1880,8 +1880,7 @@ static const char *step_into(struct nameidata *nd, int flags, return pick_link(nd, &path, inode, flags); } -static struct dentry *follow_dotdot_rcu(struct nameidata *nd, - struct inode **inodep) +static struct dentry *follow_dotdot_rcu(struct nameidata *nd) { struct dentry *parent, *old; @@ -1905,7 +1904,6 @@ static struct dentry *follow_dotdot_rcu(struct nameidata *nd, } old = nd->path.dentry; parent = old->d_parent; - *inodep = parent->d_inode; nd->next_seq = read_seqcount_begin(&parent->d_seq); // makes sure that non-RCU pathwalk could reach this state if (unlikely(read_seqcount_retry(&old->d_seq, nd->seq))) @@ -1919,12 +1917,10 @@ static struct dentry *follow_dotdot_rcu(struct nameidata *nd, if (unlikely(nd->flags & LOOKUP_BENEATH)) return ERR_PTR(-ECHILD); nd->next_seq = nd->seq; - *inodep = nd->path.dentry->d_inode; return nd->path.dentry; } -static struct dentry *follow_dotdot(struct nameidata *nd, - struct inode **inodep) +static struct dentry *follow_dotdot(struct nameidata *nd) { struct dentry *parent; @@ -1948,13 +1944,11 @@ static struct dentry *follow_dotdot(struct nameidata *nd, dput(parent); return ERR_PTR(-ENOENT); } - *inodep = parent->d_inode; return parent; in_root: if (unlikely(nd->flags & LOOKUP_BENEATH)) return ERR_PTR(-EXDEV); - *inodep = nd->path.dentry->d_inode; return dget(nd->path.dentry); } @@ -1963,7 +1957,6 @@ static const char *handle_dots(struct nameidata *nd, int type) if (type == LAST_DOTDOT) { const char *error = NULL; struct dentry *parent; - struct inode *inode; if (!nd->root.mnt) { error = ERR_PTR(set_root(nd)); @@ -1971,9 +1964,9 @@ static const char *handle_dots(struct nameidata *nd, int type) return error; } if (nd->flags & LOOKUP_RCU) - parent = follow_dotdot_rcu(nd, &inode); + parent = follow_dotdot_rcu(nd); else - parent = follow_dotdot(nd, &inode); + parent = follow_dotdot(nd); if (IS_ERR(parent)) return ERR_CAST(parent); error = step_into(nd, WALK_NOFOLLOW, parent);