[PATCH] erofs: add error log in erofs_fc_parse_param

Chen Linxuan chenlinxuan at uniontech.com
Fri Jan 17 19:52:43 AEDT 2025


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>
---
 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;
 }
-- 
2.43.0



More information about the Linux-erofs mailing list