From patchwork Sat Sep 26 09:20:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11801205 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1FA25618 for ; Sat, 26 Sep 2020 09:21:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9AB712083B for ; Sat, 26 Sep 2020 09:20:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="RD4v3uMB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726559AbgIZJU6 (ORCPT ); Sat, 26 Sep 2020 05:20:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726305AbgIZJU6 (ORCPT ); Sat, 26 Sep 2020 05:20:58 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 280B6C0613D3 for ; Sat, 26 Sep 2020 02:20:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=UWPi/1FLtgS0P8YCIByz3Ni3dIDhDRY9b0/pA0/D2vg=; b=RD4v3uMBxjzR/YsnLW18Qp+JeC lrOfwke2heZSO/9qcr86TiH7t6GY+oJO4J6aJ0pPW2U0R0V+UzWaLGgdswuvrXy42UiBwfL7M/sN+ TWHpb0t60I62EDgSC+7PgYJYBDiipn2b2vi2u2Ng4/akdeG3LD4qZ0KwAzjTQYWVwqekuji1JiHJh Ku9Yuy9qifAez71K39tSlvcW40FrksP8eqZbv6t1GdMqBjCERbQZVpMkcCyjwJFhn47kVu4/m4tNx P2srfBe+w6jEwKyKUVl4lTnrZ14XSZNT1tVcecx5N8w4Ep4onoxySDoQCBWhErwcmg6dYrQ3d2CXZ yNuAxr0w==; Received: from [46.189.67.162] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kM6O0-0002FX-MK; Sat, 26 Sep 2020 09:20:56 +0000 From: Christoph Hellwig To: Al Viro Cc: linux-fsdevel@vger.kernel.org Subject: [PATCH 1/4] fs: remove the unused fs_lookup_param function Date: Sat, 26 Sep 2020 11:20:48 +0200 Message-Id: <20200926092051.115577-2-hch@lst.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200926092051.115577-1-hch@lst.de> References: <20200926092051.115577-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Signed-off-by: Christoph Hellwig --- Documentation/filesystems/mount_api.rst | 18 +------- fs/fs_parser.c | 56 ------------------------- include/linux/fs_parser.h | 5 --- 3 files changed, 2 insertions(+), 77 deletions(-) diff --git a/Documentation/filesystems/mount_api.rst b/Documentation/filesystems/mount_api.rst index 29c169c68961f3..dbff847986da47 100644 --- a/Documentation/filesystems/mount_api.rst +++ b/Documentation/filesystems/mount_api.rst @@ -254,8 +254,8 @@ manage the filesystem context. They are as follows: will have been weeded out and fc->sb_flags updated in the context. Security options will also have been weeded out and fc->security updated. - The parameter can be parsed with fs_parse() and fs_lookup_param(). Note - that the source(s) are presented as parameters named "source". + The parameter can be parsed with fs_parse(). Note that the source(s) are + presented as parameters named "source". If successful, 0 should be returned or a negative error code otherwise. @@ -809,17 +809,3 @@ process the parameters it is given. If the parameter isn't matched, -ENOPARAM will be returned; if the parameter is matched, but the value is erroneous, -EINVAL will be returned; otherwise the parameter's option number will be returned. - - * :: - - int fs_lookup_param(struct fs_context *fc, - struct fs_parameter *value, - bool want_bdev, - struct path *_path); - - This takes a parameter that carries a string or filename type and attempts - to do a path lookup on it. If the parameter expects a blockdev, a check - is made that the inode actually represents one. - - Returns 0 if successful and ``*_path`` will be set; returns a negative - error code if not. diff --git a/fs/fs_parser.c b/fs/fs_parser.c index ab53e42a874aaa..ee40f838b2be91 100644 --- a/fs/fs_parser.c +++ b/fs/fs_parser.c @@ -133,62 +133,6 @@ int __fs_parse(struct p_log *log, } EXPORT_SYMBOL(__fs_parse); -/** - * fs_lookup_param - Look up a path referred to by a parameter - * @fc: The filesystem context to log errors through. - * @param: The parameter. - * @want_bdev: T if want a blockdev - * @_path: The result of the lookup - */ -int fs_lookup_param(struct fs_context *fc, - struct fs_parameter *param, - bool want_bdev, - struct path *_path) -{ - struct filename *f; - unsigned int flags = 0; - bool put_f; - int ret; - - switch (param->type) { - case fs_value_is_string: - f = getname_kernel(param->string); - if (IS_ERR(f)) - return PTR_ERR(f); - put_f = true; - break; - case fs_value_is_filename: - f = param->name; - put_f = false; - break; - default: - return invalf(fc, "%s: not usable as path", param->key); - } - - f->refcnt++; /* filename_lookup() drops our ref. */ - ret = filename_lookup(param->dirfd, f, flags, _path, NULL); - if (ret < 0) { - errorf(fc, "%s: Lookup failure for '%s'", param->key, f->name); - goto out; - } - - if (want_bdev && - !S_ISBLK(d_backing_inode(_path->dentry)->i_mode)) { - path_put(_path); - _path->dentry = NULL; - _path->mnt = NULL; - errorf(fc, "%s: Non-blockdev passed as '%s'", - param->key, f->name); - ret = -ENOTBLK; - } - -out: - if (put_f) - putname(f); - return ret; -} -EXPORT_SYMBOL(fs_lookup_param); - int fs_param_bad_value(struct p_log *log, struct fs_parameter *param) { return inval_plog(log, "Bad value for '%s'", param->key); diff --git a/include/linux/fs_parser.h b/include/linux/fs_parser.h index aab0ffc6bac67a..a62ed20fda6d98 100644 --- a/include/linux/fs_parser.h +++ b/include/linux/fs_parser.h @@ -73,11 +73,6 @@ static inline int fs_parse(struct fs_context *fc, return __fs_parse(&fc->log, desc, param, result); } -extern int fs_lookup_param(struct fs_context *fc, - struct fs_parameter *param, - bool want_bdev, - struct path *_path); - extern int lookup_constant(const struct constant_table tbl[], const char *name, int not_found); #ifdef CONFIG_VALIDATE_FS_PARSER From patchwork Sat Sep 26 09:20:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11801207 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 638AA92C for ; Sat, 26 Sep 2020 09:21:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3D4AB221EC for ; Sat, 26 Sep 2020 09:21:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="XEqJqv/n" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728736AbgIZJVA (ORCPT ); Sat, 26 Sep 2020 05:21:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726305AbgIZJU7 (ORCPT ); Sat, 26 Sep 2020 05:20:59 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE55AC0613CE for ; Sat, 26 Sep 2020 02:20:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=3saE7l6HWDiZo45mWuSofEheDtd0Y321gzyatxFdI5Y=; b=XEqJqv/nbXwD4R84bWmYAJRZfj YAwQ7BZzhxKBcF1ah/DPabOxvcG4dYA1NRgYXTcEQIN2ItUNVibPV4XABgwn60jXRxqKmEqaRgsiB EeAQOyXx06nhLs+701j/ibPDmb4NhVTVG3y7ECIy6CfNeGOdlPbG3KKwD8jRJSP02ztfw8jzjgnvY 06gYXoAYDSiaxMX8YVxy0mdz5lbfE+Mrz43glV9xSnARe2s6yI/3A2zeldsJmzV2kCduPCLcBGZGB Cea7htBQAej1VNyUdxRPB8++dZtnlrBfifz6ZMIcJmQfbYZaB3tf/Xq4d6WUtXCF7yPl8gd8DvnHX wmX0iWoQ==; Received: from [46.189.67.162] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kM6O1-0002Fc-Du; Sat, 26 Sep 2020 09:20:57 +0000 From: Christoph Hellwig To: Al Viro Cc: linux-fsdevel@vger.kernel.org Subject: [PATCH 2/4] fs: mark filename_lookup static Date: Sat, 26 Sep 2020 11:20:49 +0200 Message-Id: <20200926092051.115577-3-hch@lst.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200926092051.115577-1-hch@lst.de> References: <20200926092051.115577-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Signed-off-by: Christoph Hellwig --- fs/internal.h | 2 -- fs/namei.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/internal.h b/fs/internal.h index 10517ece45167f..695e12bc285061 100644 --- a/fs/internal.h +++ b/fs/internal.h @@ -71,8 +71,6 @@ extern int finish_clean_context(struct fs_context *fc); /* * namei.c */ -extern int filename_lookup(int dfd, struct filename *name, unsigned flags, - struct path *path, struct path *root); extern int vfs_path_lookup(struct dentry *, struct vfsmount *, const char *, unsigned int, struct path *); long do_rmdir(int dfd, struct filename *name); diff --git a/fs/namei.c b/fs/namei.c index e99e2a9da0f7de..7963f97a130442 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2351,7 +2351,7 @@ static int path_lookupat(struct nameidata *nd, unsigned flags, struct path *path return err; } -int filename_lookup(int dfd, struct filename *name, unsigned flags, +static int filename_lookup(int dfd, struct filename *name, unsigned flags, struct path *path, struct path *root) { int retval; From patchwork Sat Sep 26 09:20:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11801209 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C91AC16BC for ; Sat, 26 Sep 2020 09:21:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA332238E6 for ; Sat, 26 Sep 2020 09:21:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="UuOG3UEj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728871AbgIZJVB (ORCPT ); Sat, 26 Sep 2020 05:21:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726694AbgIZJU7 (ORCPT ); Sat, 26 Sep 2020 05:20:59 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A29A4C0613D3 for ; Sat, 26 Sep 2020 02:20:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=3OVxdsQImLkbv/t/rKL0Ih+YKEYR4oVCv+V+wx3AnnU=; b=UuOG3UEj5l56lurRqEvl/WyNLU FTus55A/Oc9hhQDbV86Dej5rdPST3BiaSRtBqqzAXUy/KWgFX6LXhUX7RWmizMNDeasaA9GlGqeze xcmLl9lExwqpqbkOND9pxUtOkxvIsQIQGmcfhdEL2RIX8SNS+7gUzAdn2kvpU/dyxWvtbGaUldexV VbPNO6XVZdswM4rfUnFlh/p8eq4Ekxl8wtt1qtTWglXf8BRnZ06dVPG+tbGWaoPF8fN65NxjKD0Z0 hBLxFHaM6/BI3W6TlkO8F5w7mzyb3NEsJk80aAJSlb4ybGodSQ5X8eK/gQM04wp65pau6ooEgH3IS ERCvw46w==; Received: from [46.189.67.162] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kM6O2-0002Fk-5r; Sat, 26 Sep 2020 09:20:58 +0000 From: Christoph Hellwig To: Al Viro Cc: linux-fsdevel@vger.kernel.org Subject: [PATCH 3/4] fs: pass a nameidata into filename_lookup Date: Sat, 26 Sep 2020 11:20:50 +0200 Message-Id: <20200926092051.115577-4-hch@lst.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200926092051.115577-1-hch@lst.de> References: <20200926092051.115577-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org This allows keeping the LOOKUP_ROOT case for vfs_path_lookup entirely out of the normal fast path. Signed-off-by: Christoph Hellwig --- fs/namei.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 7963f97a130442..90e1cb008ae449 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2352,22 +2352,18 @@ static int path_lookupat(struct nameidata *nd, unsigned flags, struct path *path } static int filename_lookup(int dfd, struct filename *name, unsigned flags, - struct path *path, struct path *root) + struct path *path, struct nameidata *nd) { int retval; - struct nameidata nd; + if (IS_ERR(name)) return PTR_ERR(name); - if (unlikely(root)) { - nd.root = *root; - flags |= LOOKUP_ROOT; - } - set_nameidata(&nd, dfd, name); - retval = path_lookupat(&nd, flags | LOOKUP_RCU, path); + set_nameidata(nd, dfd, name); + retval = path_lookupat(nd, flags | LOOKUP_RCU, path); if (unlikely(retval == -ECHILD)) - retval = path_lookupat(&nd, flags, path); + retval = path_lookupat(nd, flags, path); if (unlikely(retval == -ESTALE)) - retval = path_lookupat(&nd, flags | LOOKUP_REVAL, path); + retval = path_lookupat(nd, flags | LOOKUP_REVAL, path); if (likely(!retval)) audit_inode(name, path->dentry, @@ -2450,8 +2446,10 @@ struct dentry *kern_path_locked(const char *name, struct path *path) int kern_path(const char *name, unsigned int flags, struct path *path) { - return filename_lookup(AT_FDCWD, getname_kernel(name), - flags, path, NULL); + struct nameidata nd; + + return filename_lookup(AT_FDCWD, getname_kernel(name), flags, path, + &nd); } EXPORT_SYMBOL(kern_path); @@ -2467,10 +2465,12 @@ int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, const char *name, unsigned int flags, struct path *path) { - struct path root = {.mnt = mnt, .dentry = dentry}; - /* the first argument of filename_lookup() is ignored with root */ + struct nameidata nd; + + nd.root.mnt = mnt; + nd.root.dentry = dentry; return filename_lookup(AT_FDCWD, getname_kernel(name), - flags , path, &root); + flags | LOOKUP_ROOT, path, &nd); } EXPORT_SYMBOL(vfs_path_lookup); @@ -2643,8 +2643,10 @@ int path_pts(struct path *path) int user_path_at_empty(int dfd, const char __user *name, unsigned flags, struct path *path, int *empty) { + struct nameidata nd; + return filename_lookup(dfd, getname_flags(name, flags, empty), - flags, path, NULL); + flags, path, &nd); } EXPORT_SYMBOL(user_path_at_empty); From patchwork Sat Sep 26 09:20:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11801211 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 72F79618 for ; Sat, 26 Sep 2020 09:21:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 584942083B for ; Sat, 26 Sep 2020 09:21:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="DoP77tW2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728983AbgIZJVB (ORCPT ); Sat, 26 Sep 2020 05:21:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727482AbgIZJVA (ORCPT ); Sat, 26 Sep 2020 05:21:00 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E3F9C0613D4 for ; Sat, 26 Sep 2020 02:21:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=/ivdUATQZkP6+hgnvpZgn5U9ayT1PU/oH61zOJIUGD0=; b=DoP77tW2RDBYNJh7O/kZPzFgne WWz8XGRRCNYJUSqce9WVS/n1Ni8sSBsaM8bygmV65hZKmonc1g9UB0iq0L2mItNb9uY+sWJjyQg7M ng7ZC4DWqa2lDFmv+yGuLTYnKpi0/aSemq5wyTcJN+IsIOKhV30JYh1/4bzOWPHEIwy2EwcMFOiMr 2DZTq5vXu3NdqsV626MX71OVyBFp8wVf3IAkIAWogtgUKzQ7TpCGAGqaYtWvjaT+eic9hY/WALkzs IDlrzdAiRQrdb1ufJlnqVp6wfFUtWye5Zdqmv6lmq/jjzBSfqEC1faW4EHmihE/kRR3SAQ0j6DmIA n44bJe3g==; Received: from [46.189.67.162] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kM6O2-0002Fp-UY; Sat, 26 Sep 2020 09:20:59 +0000 From: Christoph Hellwig To: Al Viro Cc: linux-fsdevel@vger.kernel.org Subject: [PATCH 4/4] fs: simplify vfs_path_lookup Date: Sat, 26 Sep 2020 11:20:51 +0200 Message-Id: <20200926092051.115577-5-hch@lst.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200926092051.115577-1-hch@lst.de> References: <20200926092051.115577-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org vfs_path_lookup is only used to lookup mount points. So drop the dentry parameter that is always set to mnt->mnt_root, remove the unused export and rename the function to mount_path_lookup. Signed-off-by: Christoph Hellwig --- fs/internal.h | 4 ++-- fs/namei.c | 16 +++------------- fs/namespace.c | 8 +++----- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/fs/internal.h b/fs/internal.h index 695e12bc285061..bbdae2648f6b7d 100644 --- a/fs/internal.h +++ b/fs/internal.h @@ -71,8 +71,8 @@ extern int finish_clean_context(struct fs_context *fc); /* * namei.c */ -extern int vfs_path_lookup(struct dentry *, struct vfsmount *, - const char *, unsigned int, struct path *); +int mount_path_lookup(struct vfsmount *mnt, const char *name, + unsigned int flags, struct path *path); long do_rmdir(int dfd, struct filename *name); long do_unlinkat(int dfd, struct filename *name); int may_linkat(struct path *link); diff --git a/fs/namei.c b/fs/namei.c index 90e1cb008ae449..30f7caf5eda79b 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2453,26 +2453,16 @@ int kern_path(const char *name, unsigned int flags, struct path *path) } EXPORT_SYMBOL(kern_path); -/** - * vfs_path_lookup - lookup a file path relative to a dentry-vfsmount pair - * @dentry: pointer to dentry of the base directory - * @mnt: pointer to vfs mount of the base directory - * @name: pointer to file name - * @flags: lookup flags - * @path: pointer to struct path to fill - */ -int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, - const char *name, unsigned int flags, - struct path *path) +int mount_path_lookup(struct vfsmount *mnt, const char *name, + unsigned int flags, struct path *path) { struct nameidata nd; nd.root.mnt = mnt; - nd.root.dentry = dentry; + nd.root.dentry = mnt->mnt_root; return filename_lookup(AT_FDCWD, getname_kernel(name), flags | LOOKUP_ROOT, path, &nd); } -EXPORT_SYMBOL(vfs_path_lookup); static int lookup_one_len_common(const char *name, struct dentry *base, int len, struct qstr *this) diff --git a/fs/namespace.c b/fs/namespace.c index bae0e95b3713a3..0e904b27f7baeb 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -3368,9 +3368,8 @@ struct dentry *mount_subtree(struct vfsmount *m, const char *name) ns->mounts++; list_add(&mnt->mnt_list, &ns->list); - err = vfs_path_lookup(m->mnt_root, m, - name, LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT, &path); - + err = mount_path_lookup(m, name, LOOKUP_FOLLOW | LOOKUP_AUTOMOUNT, + &path); put_mnt_ns(ns); if (err) @@ -4060,8 +4059,7 @@ static int mntns_install(struct nsset *nsset, struct ns_common *ns) nsproxy->mnt_ns = mnt_ns; /* Find the root */ - err = vfs_path_lookup(mnt_ns->root->mnt.mnt_root, &mnt_ns->root->mnt, - "/", LOOKUP_DOWN, &root); + err = mount_path_lookup(&mnt_ns->root->mnt, "/", LOOKUP_DOWN, &root); if (err) { /* revert to old namespace */ nsproxy->mnt_ns = old_mnt_ns;