Re: [PATCH] vfs: Handle file systems without ->parse_params better

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/12/19 4:47 PM, Al Viro wrote:
On Thu, Dec 12, 2019 at 04:36:04PM -0500, Laura Abbott wrote:
@@ -141,14 +191,19 @@ int vfs_parse_fs_param(struct fs_context *fc, struct fs_parameter *param)
  		 */
  		return ret;
- if (fc->ops->parse_param) {
-		ret = fc->ops->parse_param(fc, param);
-		if (ret != -ENOPARAM)
-			return ret;
-	}
+	parse_param = fc->ops->parse_param;
+	if (!parse_param)
+		parse_param = fs_generic_parse_param;
+
+	ret = parse_param(fc, param);
+	if (ret != -ENOPARAM)
+		return ret;
- /* If the filesystem doesn't take any arguments, give it the
-	 * default handling of source.
+	/*
+	 * File systems may have a ->parse_param function but rely on
+	 * the top level to parse the source function. File systems
+	 * may have their own source parsing though so this needs
+	 * to come after the call to parse_param above.
  	 */
  	if (strcmp(param->key, "source") == 0) {
  		if (param->type != fs_value_is_string)
--
2.21.0

No.  Please, get rid of the boilerplate.  About 80% of that thing
is an absolutely pointless dance around "but we need that to call
fs_parse()".  We do *NOT* need to call fs_parse() here.  We do
not need a struct fs_parameter_description instance.  We do not
need struct fs_parameter_spec instances.  We do not need a magical
global constant.  And I'm not entirely convinced that we need
to make fs_generic_parse_param() default - filesystems that
want this behaviour can easily ask for it.  A sane default is
to reject any bogus options.


Well the existing behavior was to silently ignore options by
default so this was an attempt to preserve that behavior for
everything rather than keep hitting user visible bugs. I'd
rather not have to deal this this for each file system.

I would call it ignore_unknowns_parse_param(), while we are at it.






[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux