From patchwork Mon May 27 07:58:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13674761 Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 947A65787B; Mon, 27 May 2024 07:58:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716796700; cv=none; b=mvqZPHaapw/HcOhJ6Iy0teJGJa4rTxxcY72yuoMDmd3IDGJiTWpWUkAmGvfpskd0653suUDA5OygK1PSFtG3b4LYuB7MqV6sIIjlZwMhE82YoVirJVsbjgN7ctRGsg+sAMTN4BDrKHIHOU3F5ict6tcc+AS91IZgA8phOWnLO3M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716796700; c=relaxed/simple; bh=1V35Xtl9Gabc3cCpj/uZzgPUaqJp0QIJ5zZaPmom+dA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=f0hA0pkWDUqTHV48QQ/iXYVKaEGJagBwXyYRuziP9JvSFSXDIgS9pVMTJ4om20Us5EAo7+RR8BhNY5Lmnqueoxxfc+SmdcIjftf7mObmxEh2YnofCy9edxbO94SBjaEE2c+LX8kPQInX/NpgY6CztuWV3YakVZkckVDEYUX71dc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4VnnzW28rFz1wwV7; Mon, 27 May 2024 15:56:55 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 70B741400FD; Mon, 27 May 2024 15:58:11 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 27 May 2024 15:58:11 +0800 From: Hongbo Li To: , , , , CC: , , , , , Subject: [PATCH v2 1/4] fs: add blockdev parser for filesystem mount option. Date: Mon, 27 May 2024 15:58:51 +0800 Message-ID: <20240527075854.1260981-2-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240527075854.1260981-1-lihongbo22@huawei.com> References: <20240527075854.1260981-1-lihongbo22@huawei.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500022.china.huawei.com (7.185.36.66) `fsparam_bdev` uses `fs_param_is_blockdev` to parse the option, but it is currently empty. Filesystems like ext4 use the `fsparam_bdev` to parse `journal_path` into the block device. This general logic should be moved to the vfs layer, not the specific filesystem. Therefore, we implement block device parser in `fs_param_is_blockdev`. And the logic is similar with `fs_lookup_param`. Signed-off-by: Hongbo Li --- fs/fs_parser.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/fs/fs_parser.c b/fs/fs_parser.c index a4d6ca0b8971..2aa208cf2027 100644 --- a/fs/fs_parser.c +++ b/fs/fs_parser.c @@ -311,7 +311,56 @@ EXPORT_SYMBOL(fs_param_is_fd); int fs_param_is_blockdev(struct p_log *log, const struct fs_parameter_spec *p, struct fs_parameter *param, struct fs_parse_result *result) { - return 0; + int ret; + int dfd; + struct filename *f; + struct inode *dev_inode; + struct path path; + bool put_f; + + switch (param->type) { + case fs_value_is_string: + if (!*param->string) { + if (p->flags & fs_param_can_be_empty) + return 0; + return fs_param_bad_value(log, param); + } + f = getname_kernel(param->string); + if (IS_ERR(f)) + return fs_param_bad_value(log, param); + dfd = AT_FDCWD; + put_f = true; + break; + case fs_value_is_filename: + f = param->name; + dfd = param->dirfd; + put_f = false; + break; + default: + return fs_param_bad_value(log, param); + } + + ret = filename_lookup(dfd, f, LOOKUP_FOLLOW, &path, NULL); + if (ret < 0) { + error_plog(log, "%s: Lookup failure for '%s'", param->key, f->name); + goto out_putname; + } + + dev_inode = d_backing_inode(path.dentry); + if (!S_ISBLK(dev_inode->i_mode)) { + error_plog(log, "%s: Non-blockdev passed as '%s'", param->key, f->name); + ret = -1; + goto out_putpath; + } + result->uint_32 = new_encode_dev(dev_inode->i_rdev); + +out_putpath: + path_put(&path); +out_putname: + if (put_f) + putname(f); + + return (ret < 0) ? fs_param_bad_value(log, param) : 0; } EXPORT_SYMBOL(fs_param_is_blockdev); From patchwork Mon May 27 07:58:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13674762 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64CBA3B298; Mon, 27 May 2024 07:58:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716796701; cv=none; b=GSLx6xnFLGDrY+66njteBWhQZhxRCcspvwqa7ichaEvgWAyEw3h6duv4+X+VtFtPq4a+ubXLmaUHomc9+/tMY/RQ0bDqxYgjWyQdjjzG+u9GH/0VzNKeXTeYOymHQlsFW97niU5Sw9v3Dd2NeyFns3aqtRm/XSW7zSIS9vs0c+U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716796701; c=relaxed/simple; bh=4XOH+KIQn0yMccABDFAN4+JzP4A4dRp1QiXB4Ol3pCc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ACz9Vmez19oxnGPqDhlZ0HMoA/in2/sPAJKCc5nTmmJjiREZXDcjalvKzhxOWLVov0UeCV9fKSWP6USvEzWOJiuYuheFegckTn5FHv+QG1Cxe1MTDfSMzFsCLW/IR3ChL6VpHSJAJXRbay0ujjJJD8hnhL6VbLIod6ROFhiPBB0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4VnnxQ1JyJz1ysW0; Mon, 27 May 2024 15:55:06 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 2BC2C14037F; Mon, 27 May 2024 15:58:13 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 27 May 2024 15:58:12 +0800 From: Hongbo Li To: , , , , CC: , , , , , Subject: [PATCH v2 2/4] fs: add path parser for filesystem mount option. Date: Mon, 27 May 2024 15:58:52 +0800 Message-ID: <20240527075854.1260981-3-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240527075854.1260981-1-lihongbo22@huawei.com> References: <20240527075854.1260981-1-lihongbo22@huawei.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500022.china.huawei.com (7.185.36.66) `fsparam_path` uses `fs_param_is_path` to parse the option, but it is currently empty. The new mount api has considered this option in `fsconfig`(that is FSCONFIG_SET_PATH). Here we add general path parser in filesystem layer. Currently, no filesystem uses this function to parse parameters, we add `void *ptr` in `fs_parse_result` to point to the target structure(such as `struct inode *`). Signed-off-by: Hongbo Li --- fs/fs_parser.c | 18 ++++++++++++++++++ include/linux/fs_parser.h | 1 + 2 files changed, 19 insertions(+) diff --git a/fs/fs_parser.c b/fs/fs_parser.c index 2aa208cf2027..5d0adcc514d8 100644 --- a/fs/fs_parser.c +++ b/fs/fs_parser.c @@ -367,6 +367,24 @@ EXPORT_SYMBOL(fs_param_is_blockdev); int fs_param_is_path(struct p_log *log, const struct fs_parameter_spec *p, struct fs_parameter *param, struct fs_parse_result *result) { + int ret; + struct filename *f; + struct path path; + + if (param->type != fs_value_is_filename) + return fs_param_bad_value(log, param); + if (!*param->string && (p->flags & fs_param_can_be_empty)) + return 0; + + f = param->name; + ret = filename_lookup(param->dirfd, f, LOOKUP_FOLLOW, &path, NULL); + if (ret < 0) { + error_plog(log, "%s: Lookup failure for '%s'", param->key, f->name); + return fs_param_bad_value(log, param); + } + result->ptr = d_backing_inode(path.dentry); + path_put(&path); + return 0; } EXPORT_SYMBOL(fs_param_is_path); diff --git a/include/linux/fs_parser.h b/include/linux/fs_parser.h index d3350979115f..489c71d06a5f 100644 --- a/include/linux/fs_parser.h +++ b/include/linux/fs_parser.h @@ -57,6 +57,7 @@ struct fs_parse_result { int int_32; /* For spec_s32/spec_enum */ unsigned int uint_32; /* For spec_u32{,_octal,_hex}/spec_enum */ u64 uint_64; /* For spec_u64 */ + const void *ptr; /* For spec_ptr */ }; }; From patchwork Mon May 27 07:58:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13674759 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43D3355E49; Mon, 27 May 2024 07:58:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716796699; cv=none; b=P0w3g3czsecgYxAq50lobGJ7Xa9a/sW3VNOSWaDS9zKpw30ELyL8dTkf0Iu+r/gKgA7t8ADrydC++48xLW1TwgIPI14OoDexxCBAQn/yUxxxqZF+7J9xyWd8fA7zNBpe2gxQ4IH85mfpHg77fuMxI2GbBD6McsGa0MZIQoOcKFs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716796699; c=relaxed/simple; bh=fozoJ0jk0ztAqhByvuP6+GzV7jYHHfG4g+v9p6kdQwM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UpD3dbKh9BfFqJ3cUZWFFht9EG9z4yJktqhcJIVYJiEf/slv70zvMJk66RhJXl/3T4QYuH0JSxYowkL6IEnuxoXehbb/OelRXoIWzPN2aaTWxUNEVFt0gjqyyT216T+SF9x9UZhBWubcXKfEgxw/fFgFZaeDwefx8RqO1ndA8LA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Vnnwh0D0szxQ5d; Mon, 27 May 2024 15:54:28 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id CD3B114037D; Mon, 27 May 2024 15:58:14 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 27 May 2024 15:58:14 +0800 From: Hongbo Li To: , , , , CC: , , , , , Subject: [PATCH v2 3/4] fs: ext4: support relative path for `journal_path` in mount option. Date: Mon, 27 May 2024 15:58:53 +0800 Message-ID: <20240527075854.1260981-4-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240527075854.1260981-1-lihongbo22@huawei.com> References: <20240527075854.1260981-1-lihongbo22@huawei.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500022.china.huawei.com (7.185.36.66) After `fs_param_is_blockdev` is implemented(in fs: add blockdev parser for filesystem mount option.), `journal_devnum` can be obtained from `result.uint_32` directly. Additionally, the `fs_lookup_param` did not consider the relative path for block device. When we mount ext4 with `journal_path` option using relative path, `param->dirfd` was not set which will cause mounting error. This can be reproduced easily like this: mke2fs -F -O journal_dev $JOURNAL_DEV -b 4096 100M mkfs.ext4 -F -J device=$JOURNAL_DEV -b 4096 $FS_DEV cd /dev; mount -t ext4 -o journal_path=`basename $JOURNAL_DEV` $FS_DEV $MNT Fixes: 461c3af045d3 ("ext4: Change handle_mount_opt() to use fs_parameter") Signed-off-by: Hongbo Li --- fs/ext4/super.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index c682fb927b64..94b39bcae99d 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -2290,39 +2290,15 @@ static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param) ctx->spec |= EXT4_SPEC_s_resgid; return 0; case Opt_journal_dev: - if (is_remount) { - ext4_msg(NULL, KERN_ERR, - "Cannot specify journal on remount"); - return -EINVAL; - } - ctx->journal_devnum = result.uint_32; - ctx->spec |= EXT4_SPEC_JOURNAL_DEV; - return 0; case Opt_journal_path: - { - struct inode *journal_inode; - struct path path; - int error; - if (is_remount) { ext4_msg(NULL, KERN_ERR, "Cannot specify journal on remount"); return -EINVAL; } - - error = fs_lookup_param(fc, param, 1, LOOKUP_FOLLOW, &path); - if (error) { - ext4_msg(NULL, KERN_ERR, "error: could not find " - "journal device path"); - return -EINVAL; - } - - journal_inode = d_inode(path.dentry); - ctx->journal_devnum = new_encode_dev(journal_inode->i_rdev); + ctx->journal_devnum = result.uint_32; ctx->spec |= EXT4_SPEC_JOURNAL_DEV; - path_put(&path); return 0; - } case Opt_journal_ioprio: if (result.uint_32 > 7) { ext4_msg(NULL, KERN_ERR, "Invalid journal IO priority" From patchwork Mon May 27 07:58:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13674763 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DAE23BB59; Mon, 27 May 2024 07:58:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716796705; cv=none; b=DnEMGgaodBCbtCUytUv47QNkTxxJkDP3lnxCZXAO751KqQDbx15LXhCVu2DqycKRrAFKyARic2FZRkV9guv4ndsLiyClKYkvbqJ8Da5K6KQuxFIZ0ZTzP05Txxt0HkDOXfZZ37uJWZntawbSZUI2EF/3mEVjFbtAEz11uH85Fwo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716796705; c=relaxed/simple; bh=2pQ8OpyCvyPiThTNccORsiIJoUK+PlaXD5ACjqKjx/4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rUFBaoDbgGS8WEkb+S/NrsaOxxoKTZkXewyKxqiTGCqz45CypkaTIjdowE/EUbUHzV/HkP6f7SWqzaCukmDy+kbPhrzGvcP0rRVzeeHfEdjvTs8nCa9FyU1GSLsBLnpFN9geYi9jRQBElevbrfklN7FoG4fD3wPHW5UqXMBZL/Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4VnnxT3wyVz1ysVv; Mon, 27 May 2024 15:55:09 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 894C81A0188; Mon, 27 May 2024 15:58:16 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 27 May 2024 15:58:16 +0800 From: Hongbo Li To: , , , , CC: , , , , , Subject: [PATCH v2 4/4] fs: remove fs_lookup_param and its description. Date: Mon, 27 May 2024 15:58:54 +0800 Message-ID: <20240527075854.1260981-5-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240527075854.1260981-1-lihongbo22@huawei.com> References: <20240527075854.1260981-1-lihongbo22@huawei.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500022.china.huawei.com (7.185.36.66) After `fs_param_is_blockdev` and `fs_param_is_path` are implemented, there are no need to lookup the path with `fs_lookup_param`, and `fs_parse` is sufficient. Signed-off-by: Hongbo Li --- Documentation/filesystems/mount_api.rst | 17 +------- fs/fs_parser.c | 56 ------------------------- include/linux/fs_parser.h | 6 --- 3 files changed, 1 insertion(+), 78 deletions(-) diff --git a/Documentation/filesystems/mount_api.rst b/Documentation/filesystems/mount_api.rst index 9aaf6ef75eb5..f92d96758e57 100644 --- a/Documentation/filesystems/mount_api.rst +++ b/Documentation/filesystems/mount_api.rst @@ -253,7 +253,7 @@ 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 + 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. @@ -796,18 +796,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, - unsigned int flags, - 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 5d0adcc514d8..962adb1fec80 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 - * @flags: Pathwalk flags passed to filename_lookup() - * @_path: The result of the lookup - */ -int fs_lookup_param(struct fs_context *fc, - struct fs_parameter *param, - bool want_bdev, - unsigned int flags, - struct path *_path) -{ - struct filename *f; - 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); - } - - 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); - static 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 489c71d06a5f..fa2745254818 100644 --- a/include/linux/fs_parser.h +++ b/include/linux/fs_parser.h @@ -74,12 +74,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, - unsigned int flags, - struct path *_path); - extern int lookup_constant(const struct constant_table tbl[], const char *name, int not_found); #ifdef CONFIG_VALIDATE_FS_PARSER