Commit bee6c307 authored by Brian Foster's avatar Brian Foster Committed by Miklos Szeredi
Browse files

fuse: update inode size and invalidate attributes on fallocate

An fallocate request without FALLOC_FL_KEEP_SIZE set can extend the
size of a file. Update the inode size after a successful fallocate.

Also invalidate the inode attributes after a successful fallocate
to ensure we pick up the latest attribute values (i.e., i_blocks).

Signed-off-by: default avatarBrian Foster <>
Signed-off-by: default avatarMiklos Szeredi <>
parent 3634a632
......@@ -2492,11 +2492,20 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
fuse_put_request(fc, req);
if (err)
goto out;
/* we could have extended the file */
if (!(mode & FALLOC_FL_KEEP_SIZE))
fuse_write_update_size(inode, offset + length);
truncate_pagecache_range(inode, offset, offset + length - 1);
if (mode & FALLOC_FL_PUNCH_HOLE) {
if (!err)
truncate_pagecache_range(inode, offset,
offset + length - 1);
Supports Markdown
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