[Devel] [PATCH 1/3] fuse: Fix parse_fuse_opt() return values wrong interpretation

Pavel Butsykin pbutsykin at virtuozzo.com
Tue Oct 30 15:26:25 MSK 2018


On 30.10.2018 11:55, Kirill Tkhai wrote:
> This function returns not 0 in case of success, and 0 in case
> of failure. So, error values like -EPERM are interpreted as
> success, which is wrong. Fix that.
> Note, that fuse has generic EINVAL return value for all types
> of unacceptable parameters.
> 
> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>

Reviewed-by: Pavel Butsykin <pbutsykin at virtuozzo.com>

> ---
>   fs/fuse/inode.c |    8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
> index ca9a146d39fa..0695b79c4c50 100644
> --- a/fs/fuse/inode.c
> +++ b/fs/fuse/inode.c
> @@ -688,19 +688,19 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev)
>   
>   		case OPT_WBCACHE:
>   			if (!ve_is_super(get_exec_env()) && !fuse_ve_odirect)
> -				return -EPERM;
> +				return 0;
>   			d->writeback_cache = 1;
>   			break;
>   
>   		case OPT_ODIRECT:
>   			if (!ve_is_super(get_exec_env()) && !fuse_ve_odirect)
> -				return -EPERM;
> +				return 0;
>   			d->flags |= FUSE_ODIRECT;
>   			break;
>   
>   		case OPT_UMOUNT_WAIT:
>   			if (!ve_is_super(get_exec_env()) && !fuse_ve_odirect)
> -				return -EPERM;
> +				return 0;
>   			d->flags |= FUSE_UMOUNT_WAIT;
>   			break;
>   
> @@ -711,7 +711,7 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev)
>   			char *name;
>   			name = match_strdup(&args[0]);
>   			if (!name)
> -				return 1;
> +				return 0;
>   
>   			strncpy(d->kio_name, name, FUSE_KIO_NAME);
>   			d->flags |= FUSE_KDIRECT_IO;
> 



More information about the Devel mailing list