From: Liu Bo Date: Wed, 17 Apr 2019 20:04:41 +0000 (+0800) Subject: fuse: honor RLIMIT_FSIZE in fuse_file_fallocate X-Git-Tag: v3.16.74~86 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e09925b72cc58decfc28f8cf183a24198fba4864;p=thirdparty%2Fkernel%2Fstable.git fuse: honor RLIMIT_FSIZE in fuse_file_fallocate commit 0cbade024ba501313da3b7e5dd2a188a6bc491b5 upstream. fstests 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 Fixes: 05ba1f082300 ("fuse: add FALLOCATE operation") Signed-off-by: Miklos Szeredi Signed-off-by: Ben Hutchings --- diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 9d92f83348d1a..7bb97212439d4 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -3017,6 +3017,13 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset, } } + 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);