1 From 0cbade024ba501313da3b7e5dd2a188a6bc491b5 Mon Sep 17 00:00:00 2001
2 From: Liu Bo <bo.liu@linux.alibaba.com>
3 Date: Thu, 18 Apr 2019 04:04:41 +0800
4 Subject: fuse: honor RLIMIT_FSIZE in fuse_file_fallocate
6 From: Liu Bo <bo.liu@linux.alibaba.com>
8 commit 0cbade024ba501313da3b7e5dd2a188a6bc491b5 upstream.
10 fstests generic/228 reported this failure that fuse fallocate does not
11 honor what 'ulimit -f' has set.
13 This adds the necessary inode_newsize_ok() check.
15 Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
16 Fixes: 05ba1f082300 ("fuse: add FALLOCATE operation")
17 Cc: <stable@vger.kernel.org> # v3.5
18 Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 fs/fuse/file.c | 7 +++++++
23 1 file changed, 7 insertions(+)
27 @@ -2987,6 +2987,13 @@ static long fuse_file_fallocate(struct f
31 + if (!(mode & FALLOC_FL_KEEP_SIZE) &&
32 + offset + length > i_size_read(inode)) {
33 + err = inode_newsize_ok(inode, offset + length);
38 if (!(mode & FALLOC_FL_KEEP_SIZE))
39 set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state);