diff options
author | Liu Bo <bo.liu@linux.alibaba.com> | 2019-04-17 16:04:41 -0400 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2019-04-24 11:05:06 -0400 |
commit | 0cbade024ba501313da3b7e5dd2a188a6bc491b5 (patch) | |
tree | 5766b4c3a874f5c58bf2ebc91baa9ae845c83f70 | |
parent | 9de5be06d0a89ca97b5ab902694d42dfd2bb77d2 (diff) |
fuse: honor RLIMIT_FSIZE in fuse_file_fallocate
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>
-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 5428c81879b2..f811af4f6507 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -3044,6 +3044,13 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset, | |||
3044 | } | 3044 | } |
3045 | } | 3045 | } |
3046 | 3046 | ||
3047 | if (!(mode & FALLOC_FL_KEEP_SIZE) && | ||
3048 | offset + length > i_size_read(inode)) { | ||
3049 | err = inode_newsize_ok(inode, offset + length); | ||
3050 | if (err) | ||
3051 | return err; | ||
3052 | } | ||
3053 | |||
3047 | if (!(mode & FALLOC_FL_KEEP_SIZE)) | 3054 | if (!(mode & FALLOC_FL_KEEP_SIZE)) |
3048 | set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state); | 3055 | set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state); |
3049 | 3056 | ||