[Devel] [PATCH rh8] ext4/balloon: Use proper O_ mode flags in balloon opening code

Kirill Tkhai ktkhai at virtuozzo.com
Fri May 21 18:02:51 MSK 2021


On 21.05.2021 17:32, Konstantin Khorenko wrote:
> alloc_file() expects O_* mode flags, so provide them, not
> internal FMODE_* ones.
> 
> Fixes: bee340a206d7 ("ext4: Provide a balloon nipple for management")
> https://jira.sw.ru/browse/PSBM-129392
> 
> Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>

Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>

> ---
>  fs/ext4/ioctl.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
> index ecdc15881007..6d5b5e2eda91 100644
> --- a/fs/ext4/ioctl.c
> +++ b/fs/ext4/ioctl.c
> @@ -775,11 +775,11 @@ static int ext4_open_balloon(struct super_block *sb, struct vfsmount *mnt)
>  	path.mnt = mntget(mnt);
>  	err = mnt_want_write(path.mnt);
>  	if (err)
> -		mode = FMODE_READ;
> +		mode = O_RDONLY;
>  	else
> -		mode = FMODE_READ | FMODE_WRITE;
> +		mode = O_RDWR;
>  	filp = alloc_file(&path, mode, &ext4_file_operations);
> -	if (mode & FMODE_WRITE)
> +	if (filp->f_mode & FMODE_WRITE)
>  		mnt_drop_write(path.mnt);
>  	if (IS_ERR(filp)) {
>  		err = PTR_ERR(filp);
> 



More information about the Devel mailing list