Re: [PATCH] autofs: Test autofs versions first on sb initialization

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

 



On Sat, 2016-07-02 at 22:29 +0900, Tomohiro Kusumi wrote:
> This patch does what the below comment says.
> It could be and it's considered better to do this first
> before various functions get called during initialization.

I don't really see the importance of this but ok.

Though looking at it I think a problem with the error handling gotos has crept
in (I think prior to your patch).

I'll need to look more closely at that when I get time.

> 
> /* Couldn't this be tested earlier? */
> ---
>  fs/autofs4/inode.c | 34 +++++++++++++++++-----------------
>  1 file changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
> index 61b2105..8357544 100644
> --- a/fs/autofs4/inode.c
> +++ b/fs/autofs4/inode.c
> @@ -274,6 +274,23 @@ int autofs4_fill_super(struct super_block *s, void *data,
> int silent)
>  		goto fail_dput;
>  	}
>  
> +	/* Test versions first */
> +	if (sbi->max_proto < AUTOFS_MIN_PROTO_VERSION ||
> +	    sbi->min_proto > AUTOFS_MAX_PROTO_VERSION) {
> +		pr_err("kernel does not match daemon version "
> +		       "daemon (%d, %d) kernel (%d, %d)\n",
> +		       sbi->min_proto, sbi->max_proto,
> +		       AUTOFS_MIN_PROTO_VERSION, AUTOFS_MAX_PROTO_VERSION);
> +		goto fail_dput;
> +	}
> +
> +	/* Establish highest kernel protocol version */
> +	if (sbi->max_proto > AUTOFS_MAX_PROTO_VERSION)
> +		sbi->version = AUTOFS_MAX_PROTO_VERSION;
> +	else
> +		sbi->version = sbi->max_proto;
> +	sbi->sub_version = AUTOFS_PROTO_SUBVERSION;
> +
>  	if (pgrp_set) {
>  		sbi->oz_pgrp = find_get_pid(pgrp);
>  		if (!sbi->oz_pgrp) {
> @@ -291,23 +308,6 @@ int autofs4_fill_super(struct super_block *s, void *data,
> int silent)
>  	root_inode->i_fop = &autofs4_root_operations;
>  	root_inode->i_op = &autofs4_dir_inode_operations;
>  
> -	/* Couldn't this be tested earlier? */
> -	if (sbi->max_proto < AUTOFS_MIN_PROTO_VERSION ||
> -	    sbi->min_proto > AUTOFS_MAX_PROTO_VERSION) {
> -		pr_err("kernel does not match daemon version "
> -		       "daemon (%d, %d) kernel (%d, %d)\n",
> -		       sbi->min_proto, sbi->max_proto,
> -		       AUTOFS_MIN_PROTO_VERSION, AUTOFS_MAX_PROTO_VERSION);
> -		goto fail_dput;
> -	}
> -
> -	/* Establish highest kernel protocol version */
> -	if (sbi->max_proto > AUTOFS_MAX_PROTO_VERSION)
> -		sbi->version = AUTOFS_MAX_PROTO_VERSION;
> -	else
> -		sbi->version = sbi->max_proto;
> -	sbi->sub_version = AUTOFS_PROTO_SUBVERSION;
> -
>  	pr_debug("pipe fd = %d, pgrp = %u\n", pipefd, pid_nr(sbi->oz_pgrp));
>  	pipe = fget(pipefd);
>  
--
To unsubscribe from this list: send the line "unsubscribe autofs" in



[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux