[Virtio-fs] [PATCH 8/9] virtio-fs: honor RLIMIT_FSIZE in fuse_file_fallocate

Vivek Goyal vgoyal at redhat.com
Tue Apr 16 19:57:46 UTC 2019


On Wed, Apr 17, 2019 at 02:03:21AM +0800, Liu Bo wrote:
> generic/228 reported this failure that fuse fallocate does not honor what
> 'ulimit -f' has set.
> 
> This adds the necessary inode_newsize_ok() check.
> 
> Signed-off-by: Liu Bo <bo.liu at linux.alibaba.com>

This sounds like a generic fallocate() fixed needed in fuse as well? If
that's the case, it will be better to send it to Miklos directly and cc
fuse mailing list.

Vivek

> ---
>  fs/fuse/file.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/fs/fuse/file.c b/fs/fuse/file.c
> index 712fd97..6ab23d7 100644
> --- a/fs/fuse/file.c
> +++ b/fs/fuse/file.c
> @@ -3589,6 +3589,13 @@ static long __fuse_file_fallocate(struct file *file, int mode,
>  		fuse_sync_writes(inode);
>  	}
>  
> +	if (!(mode & FALLOC_FL_KEEP_SIZE) &&
> +	    offset + length > i_size_read(inode)) {
> +		err = inode_newsize_ok(inode, offset + length);
> +		if (err)
> +			return err;
> +	}
> +
>  	if (!(mode & FALLOC_FL_KEEP_SIZE))
>  		set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state);
>  
> -- 
> 1.8.3.1
> 
> _______________________________________________
> Virtio-fs mailing list
> Virtio-fs at redhat.com
> https://www.redhat.com/mailman/listinfo/virtio-fs




More information about the Virtio-fs mailing list