[PATCH] erofs: add error log in erofs_fc_parse_param

Chen Linxuan chenlinxuan at uniontech.com
Fri Jan 17 21:01:17 AEDT 2025


On Fri, 2025-01-17 at 17:54 +0800, Gao Xiang wrote:
> 
> On 2025/1/17 17:50, Chen Linxuan wrote:
> > On Fri, 2025-01-17 at 17:28 +0800, Gao Xiang wrote:
> > > Hi Linxuan,
> > > 
> > > On 2025/1/17 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.
> > > > 
> > > > 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 at uniontech.com>
> > > 
> > > I think the default branch is actually deadcode here, see
> > > erofs_fc_parse_param() -> fs_parse() -> fs_lookup_key() -> -ENOPARAM
> > > 
> > > then vfs_parse_fs_param() will show "Unknown parameter".
> > > 
> > > Maybe we could just kill `default:` branch...
> > 
> > ext4 do not have a `default:` branch, but xfs return -EINVAL.
> > 
> > I think `default:` branch can report error when `fs_parse` or
> > `erofs_fs_parameters` goes wrong.
> 
> How can it go wrong?

I will push a new patch just remove the `default:` branch later.

> 
> Thanks,
> Gao Xiang
> 
> 



More information about the Linux-erofs mailing list