diff options
author | Liu Bo <bo.liu@linux.alibaba.com> | 2019-04-18 04:04:41 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-05-25 18:22:09 +0200 |
commit | bf076fd44bd654fb0aca707a5c4b8ab53a6df885 (patch) | |
tree | bf8e5caf27e5038447e5324bb185e30d155b3762 /fs | |
parent | 79d8f6321221468a60c35bea6f897ba64951a781 (diff) |
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 <bo.liu@linux.alibaba.com>
Fixes: 05ba1f082300 ("fuse: add FALLOCATE operation")
Cc: <stable@vger.kernel.org> # v3.5
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fuse/file.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index a201768a95df..50470a73f603 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -2987,6 +2987,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); |