Commit d2ad7824 authored by Liu Bo's avatar Liu Bo Committed by Kleber Sacilotto de Souza

fuse: honor RLIMIT_FSIZE in fuse_file_fallocate

BugLink: https://bugs.launchpad.net/bugs/1832661

commit 0cbade02 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: default avatarLiu Bo <bo.liu@linux.alibaba.com>
Fixes: 05ba1f08 ("fuse: add FALLOCATE operation")
Cc: <stable@vger.kernel.org> # v3.5
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent e4be861a
...@@ -2959,6 +2959,13 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset, ...@@ -2959,6 +2959,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)) if (!(mode & FALLOC_FL_KEEP_SIZE))
set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state); set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment