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=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham 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 08E9AC32771 for ; Sun, 19 Jan 2020 03:23:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D911E2083E for ; Sun, 19 Jan 2020 03:23:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726954AbgASDX2 (ORCPT ); Sat, 18 Jan 2020 22:23:28 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:56890 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725497AbgASDX1 (ORCPT ); Sat, 18 Jan 2020 22:23:27 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1it1Ai-00BFdV-W6; Sun, 19 Jan 2020 03:22:51 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Aleksa Sarai , David Howells , Eric Biederman , Christian Brauner , Al Viro Subject: [PATCH 17/17] expand the only remaining call of path_lookup_conditional() Date: Sun, 19 Jan 2020 03:17:29 +0000 Message-Id: <20200119031738.2681033-17-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200119031738.2681033-1-viro@ZenIV.linux.org.uk> References: <20200119031423.GV8904@ZenIV.linux.org.uk> <20200119031738.2681033-1-viro@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro Signed-off-by: Al Viro --- fs/namei.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 6852a0dcb25d..e840472ab9bf 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -816,13 +816,6 @@ static void set_root(struct nameidata *nd) } } -static void path_put_conditional(struct path *path, struct nameidata *nd) -{ - dput(path->dentry); - if (path->mnt != nd->path.mnt) - mntput(path->mnt); -} - static inline void path_to_nameidata(const struct path *path, struct nameidata *nd) { @@ -1233,8 +1226,11 @@ static int follow_managed(struct path *path, struct nameidata *nd) ret = 1; if (ret > 0 && unlikely(d_flags_negative(flags))) ret = -ENOENT; - if (unlikely(ret < 0)) - path_put_conditional(path, nd); + if (unlikely(ret < 0)) { + dput(path->dentry); + if (path->mnt != nd->path.mnt) + mntput(path->mnt); + } return ret; } -- 2.20.1