diff mbox series

efs: fix the efs new mount api implementation

Message ID 20241014190241.4093825-1-bodonnel@redhat.com (mailing list archive)
State New
Headers show
Series efs: fix the efs new mount api implementation | expand

Commit Message

Bill O'Donnell Oct. 14, 2024, 7:02 p.m. UTC
Commit 39a6c668e4 (efs: convert efs to use the new mount api)
did not include anything from v2 and v3 that were also submitted.
Fix this by bringing in those changes that were proposed in v2 and
v3.

Fixes: 39a6c668e4 efs: convert efs to use the new mount api.

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
---
 fs/efs/super.c | 43 +++----------------------------------------
 1 file changed, 3 insertions(+), 40 deletions(-)

Comments

Christian Brauner Oct. 15, 2024, 1:59 p.m. UTC | #1
On Mon, 14 Oct 2024 14:02:41 -0500, Bill O'Donnell wrote:
> Commit 39a6c668e4 (efs: convert efs to use the new mount api)
> did not include anything from v2 and v3 that were also submitted.
> Fix this by bringing in those changes that were proposed in v2 and
> v3.
> 
> Fixes: 39a6c668e4 efs: convert efs to use the new mount api.
> 
> [...]

Applied to the vfs.mount.api branch of the vfs/vfs.git tree.
Patches in the vfs.mount.api branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.mount.api

[1/1] efs: fix the efs new mount api implementation
      https://git.kernel.org/vfs/vfs/c/51ceeb1a8142
Eric Sandeen Oct. 15, 2024, 5:33 p.m. UTC | #2
On 10/14/24 2:02 PM, Bill O'Donnell wrote:
> Commit 39a6c668e4 (efs: convert efs to use the new mount api)
> did not include anything from v2 and v3 that were also submitted.
> Fix this by bringing in those changes that were proposed in v2 and
> v3.
> 
> Fixes: 39a6c668e4 efs: convert efs to use the new mount api.
> 
> Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>

Thanks Bill. 

I'd kind of like to see efs_context_opts renamed to efs_context_ops - this
is an ops vector, nothing to do with opts or "options."

But I hadn't caught that on the first review, and functionally this fixes
the in fill_super problems and removes the dead code, so:

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  fs/efs/super.c | 43 +++----------------------------------------
>  1 file changed, 3 insertions(+), 40 deletions(-)
> 
> diff --git a/fs/efs/super.c b/fs/efs/super.c
> index e4421c10caeb..c59086b7eabf 100644
> --- a/fs/efs/super.c
> +++ b/fs/efs/super.c
> @@ -15,7 +15,6 @@
>  #include <linux/vfs.h>
>  #include <linux/blkdev.h>
>  #include <linux/fs_context.h>
> -#include <linux/fs_parser.h>
>  #include "efs.h"
>  #include <linux/efs_vh.h>
>  #include <linux/efs_fs_sb.h>
> @@ -49,15 +48,6 @@ static struct pt_types sgi_pt_types[] = {
>  	{0,		NULL}
>  };
>  
> -enum {
> -	Opt_explicit_open,
> -};
> -
> -static const struct fs_parameter_spec efs_param_spec[] = {
> -	fsparam_flag    ("explicit-open",       Opt_explicit_open),
> -	{}
> -};
> -
>  /*
>   * File system definition and registration.
>   */
> @@ -67,7 +57,6 @@ static struct file_system_type efs_fs_type = {
>  	.kill_sb		= efs_kill_sb,
>  	.fs_flags		= FS_REQUIRES_DEV,
>  	.init_fs_context	= efs_init_fs_context,
> -	.parameters		= efs_param_spec,
>  };
>  MODULE_ALIAS_FS("efs");
>  
> @@ -265,7 +254,8 @@ static int efs_fill_super(struct super_block *s, struct fs_context *fc)
>  	if (!sb_set_blocksize(s, EFS_BLOCKSIZE)) {
>  		pr_err("device does not support %d byte blocks\n",
>  			EFS_BLOCKSIZE);
> -		return -EINVAL;
> +		return invalf(fc, "device does not support %d byte blocks\n",
> +			      EFS_BLOCKSIZE);
>  	}
>  
>  	/* read the vh (volume header) block */
> @@ -327,43 +317,22 @@ static int efs_fill_super(struct super_block *s, struct fs_context *fc)
>  	return 0;
>  }
>  
> -static void efs_free_fc(struct fs_context *fc)
> -{
> -	kfree(fc->fs_private);
> -}
> -
>  static int efs_get_tree(struct fs_context *fc)
>  {
>  	return get_tree_bdev(fc, efs_fill_super);
>  }
>  
> -static int efs_parse_param(struct fs_context *fc, struct fs_parameter *param)
> -{
> -	int token;
> -	struct fs_parse_result result;
> -
> -	token = fs_parse(fc, efs_param_spec, param, &result);
> -	if (token < 0)
> -		return token;
> -	return 0;
> -}
> -
>  static int efs_reconfigure(struct fs_context *fc)
>  {
>  	sync_filesystem(fc->root->d_sb);
> +	fc->sb_flags |= SB_RDONLY;
>  
>  	return 0;
>  }
>  
> -struct efs_context {
> -	unsigned long s_mount_opts;
> -};
> -
>  static const struct fs_context_operations efs_context_opts = {
> -	.parse_param	= efs_parse_param,
>  	.get_tree	= efs_get_tree,
>  	.reconfigure	= efs_reconfigure,
> -	.free		= efs_free_fc,
>  };
>  
>  /*
> @@ -371,12 +340,6 @@ static const struct fs_context_operations efs_context_opts = {
>   */
>  static int efs_init_fs_context(struct fs_context *fc)
>  {
> -	struct efs_context *ctx;
> -
> -	ctx = kzalloc(sizeof(struct efs_context), GFP_KERNEL);
> -	if (!ctx)
> -		return -ENOMEM;
> -	fc->fs_private = ctx;
>  	fc->ops = &efs_context_opts;
>  
>  	return 0;
diff mbox series

Patch

diff --git a/fs/efs/super.c b/fs/efs/super.c
index e4421c10caeb..c59086b7eabf 100644
--- a/fs/efs/super.c
+++ b/fs/efs/super.c
@@ -15,7 +15,6 @@ 
 #include <linux/vfs.h>
 #include <linux/blkdev.h>
 #include <linux/fs_context.h>
-#include <linux/fs_parser.h>
 #include "efs.h"
 #include <linux/efs_vh.h>
 #include <linux/efs_fs_sb.h>
@@ -49,15 +48,6 @@  static struct pt_types sgi_pt_types[] = {
 	{0,		NULL}
 };
 
-enum {
-	Opt_explicit_open,
-};
-
-static const struct fs_parameter_spec efs_param_spec[] = {
-	fsparam_flag    ("explicit-open",       Opt_explicit_open),
-	{}
-};
-
 /*
  * File system definition and registration.
  */
@@ -67,7 +57,6 @@  static struct file_system_type efs_fs_type = {
 	.kill_sb		= efs_kill_sb,
 	.fs_flags		= FS_REQUIRES_DEV,
 	.init_fs_context	= efs_init_fs_context,
-	.parameters		= efs_param_spec,
 };
 MODULE_ALIAS_FS("efs");
 
@@ -265,7 +254,8 @@  static int efs_fill_super(struct super_block *s, struct fs_context *fc)
 	if (!sb_set_blocksize(s, EFS_BLOCKSIZE)) {
 		pr_err("device does not support %d byte blocks\n",
 			EFS_BLOCKSIZE);
-		return -EINVAL;
+		return invalf(fc, "device does not support %d byte blocks\n",
+			      EFS_BLOCKSIZE);
 	}
 
 	/* read the vh (volume header) block */
@@ -327,43 +317,22 @@  static int efs_fill_super(struct super_block *s, struct fs_context *fc)
 	return 0;
 }
 
-static void efs_free_fc(struct fs_context *fc)
-{
-	kfree(fc->fs_private);
-}
-
 static int efs_get_tree(struct fs_context *fc)
 {
 	return get_tree_bdev(fc, efs_fill_super);
 }
 
-static int efs_parse_param(struct fs_context *fc, struct fs_parameter *param)
-{
-	int token;
-	struct fs_parse_result result;
-
-	token = fs_parse(fc, efs_param_spec, param, &result);
-	if (token < 0)
-		return token;
-	return 0;
-}
-
 static int efs_reconfigure(struct fs_context *fc)
 {
 	sync_filesystem(fc->root->d_sb);
+	fc->sb_flags |= SB_RDONLY;
 
 	return 0;
 }
 
-struct efs_context {
-	unsigned long s_mount_opts;
-};
-
 static const struct fs_context_operations efs_context_opts = {
-	.parse_param	= efs_parse_param,
 	.get_tree	= efs_get_tree,
 	.reconfigure	= efs_reconfigure,
-	.free		= efs_free_fc,
 };
 
 /*
@@ -371,12 +340,6 @@  static const struct fs_context_operations efs_context_opts = {
  */
 static int efs_init_fs_context(struct fs_context *fc)
 {
-	struct efs_context *ctx;
-
-	ctx = kzalloc(sizeof(struct efs_context), GFP_KERNEL);
-	if (!ctx)
-		return -ENOMEM;
-	fc->fs_private = ctx;
 	fc->ops = &efs_context_opts;
 
 	return 0;