[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a9ab830c-241d-4a78-9909-9c986ad91741@themaw.net>
Date: Sat, 18 Jan 2025 09:25:33 +0800
From: Ian Kent <raven@...maw.net>
To: Chen Linxuan <chenlinxuan@...ontech.com>, Gao Xiang <xiang@...nel.org>,
Chao Yu <chao@...nel.org>, Yue Hu <zbestahu@...il.com>,
Jeffle Xu <jefflexu@...ux.alibaba.com>, Sandeep Dhavale <dhavale@...gle.com>
Cc: linux-erofs@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] erofs: add error log in erofs_fc_parse_param
On 18/1/25 08:45, Ian Kent wrote:
> On 17/1/25 16:52, Chen Linxuan wrote:
>> While reading erofs code, I notice that `erofs_fc_parse_param` will
>> return -ENOPARAM, which means that erofs do not support this option,
>> without report anything when `fs_parse` return an unknown `opt`.
>>
>> But if an option is unknown to erofs, I mean that option not in
>> `erofs_fs_parameters` at all, `fs_parse` will return -ENOPARAM,
>> which means that `erofs_fs_parameters` should has returned earlier.
>
> I'm pretty sure than the vfs deals with reporting unknown options
>
> and returns -EINVAL already.
>
>
> I think the caller oferofs_fc_parse_param() is vfs_parse_fs_param()
>
> and for an -ENOPARAM return will ultimately do this:
>
> return invalf(fc, "%s: Unknown parameter '%s'", fc->fs_type->name,
> param->key);
>
> which does this.
>
> The thing about this is the mount API macro deals with (or it should,
>
> although I'm not sure that's completely sorted out yet) logging the
>
> message to the console log as well as possibly making it available to
>
> mount api system calls. I'm pretty sure this change will prevent the
>
> error message being available for mount api system calls to retrieve.
Actually no, removing the default switch branch does look like the right
thing
to do, my mistake. The call to fs_parse() will return -NOPARAM so the
switch doesn't need to handle that case.
Oops!
>
> Ian
>
>>
>> Entering `default` means `fs_parse` return something we unexpected.
>> I am not sure about it but I think we should return -EINVAL here,
>> just like `xfs_fs_parse_param`.
>>
>> Signed-off-by: Chen Linxuan <chenlinxuan@...ontech.com>
>> ---
>> fs/erofs/super.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
>> index 1fc5623c3a4d..67fc4c1deb98 100644
>> --- a/fs/erofs/super.c
>> +++ b/fs/erofs/super.c
>> @@ -509,7 +509,8 @@ static int erofs_fc_parse_param(struct fs_context
>> *fc,
>> #endif
>> break;
>> default:
>> - return -ENOPARAM;
>> + errorfc(fc, "%s option not supported", param->key);
>> + return -EINVAL;
>> }
>> return 0;
>> }
Powered by blists - more mailing lists