Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030678AbbEEFlz (ORCPT ); Tue, 5 May 2015 01:41:55 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:39719 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755582AbbEEFW7 (ORCPT ); Tue, 5 May 2015 01:22:59 -0400 From: Al Viro To: Linus Torvalds Cc: Neil Brown , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 28/79] namei: lift nameidata into filename_mountpoint() Date: Tue, 5 May 2015 06:22:02 +0100 Message-Id: <1430803373-4948-28-git-send-email-viro@ZenIV.linux.org.uk> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <20150505052205.GS889@ZenIV.linux.org.uk> References: <20150505052205.GS889@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2410 Lines: 83 From: Al Viro when we go for on-demand allocation of saved state in link_path_walk(), we'll want nameidata to stay around for all 3 calls of path_mountpoint(). Signed-off-by: Al Viro --- fs/namei.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index fed19ad..b9cfdc1 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2336,31 +2336,28 @@ out: */ static int path_mountpoint(int dfd, const struct filename *name, struct path *path, - unsigned int flags) + struct nameidata *nd, unsigned int flags) { - struct nameidata nd; - int err; - - err = path_init(dfd, name, flags, &nd); + int err = path_init(dfd, name, flags, nd); if (unlikely(err)) goto out; - err = mountpoint_last(&nd, path); + err = mountpoint_last(nd, path); while (err > 0) { void *cookie; struct path link = *path; - err = may_follow_link(&link, &nd); + err = may_follow_link(&link, nd); if (unlikely(err)) break; - nd.flags |= LOOKUP_PARENT; - err = follow_link(&link, &nd, &cookie); + nd->flags |= LOOKUP_PARENT; + err = follow_link(&link, nd, &cookie); if (err) break; - err = mountpoint_last(&nd, path); - put_link(&nd, &link, cookie); + err = mountpoint_last(nd, path); + put_link(nd, &link, cookie); } out: - path_cleanup(&nd); + path_cleanup(nd); return err; } @@ -2368,14 +2365,15 @@ static int filename_mountpoint(int dfd, struct filename *name, struct path *path, unsigned int flags) { + struct nameidata nd; int error; if (IS_ERR(name)) return PTR_ERR(name); - error = path_mountpoint(dfd, name, path, flags | LOOKUP_RCU); + error = path_mountpoint(dfd, name, path, &nd, flags | LOOKUP_RCU); if (unlikely(error == -ECHILD)) - error = path_mountpoint(dfd, name, path, flags); + error = path_mountpoint(dfd, name, path, &nd, flags); if (unlikely(error == -ESTALE)) - error = path_mountpoint(dfd, name, path, flags | LOOKUP_REVAL); + error = path_mountpoint(dfd, name, path, &nd, flags | LOOKUP_REVAL); if (likely(!error)) audit_inode(name, path->dentry, 0); putname(name); -- 2.1.4 -- 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/