Skip to content

Commit

Permalink
fuse: honor RLIMIT_FSIZE in fuse_file_fallocate
Browse files Browse the repository at this point in the history
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 <[email protected]>
Fixes: 05ba1f0 ("fuse: add FALLOCATE operation")
Cc: <[email protected]> # v3.5
Signed-off-by: Miklos Szeredi <[email protected]>
  • Loading branch information
liubogithub authored and Miklos Szeredi committed Apr 24, 2019
1 parent 9de5be0 commit 0cbade0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -3044,6 +3044,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);

Expand Down

0 comments on commit 0cbade0

Please sign in to comment.