Skip to content

Commit

Permalink
ext4: fix mmap data corruption when blocksize < pagesize
Browse files Browse the repository at this point in the history
commit d6320cb upstream.

Use truncate_isize_extended() when hole is being created in a file so that
->page_mkwrite() will get called for the partial tail page if it is
mmaped (see the first patch in the series for details).

Signed-off-by: Jan Kara <[email protected]>
Signed-off-by: Theodore Ts'o <[email protected]>
Signed-off-by: Jiri Slaby <[email protected]>
  • Loading branch information
jankara authored and Jiri Slaby committed Nov 13, 2014
1 parent 0dce193 commit 97f94c2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -4655,8 +4655,12 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
ext4_orphan_del(NULL, inode);
goto err_out;
}
} else
} else {
loff_t oldsize = inode->i_size;

i_size_write(inode, attr->ia_size);
pagecache_isize_extended(inode, oldsize, inode->i_size);
}

/*
* Blocks are going to be removed from the inode. Wait
Expand Down

0 comments on commit 97f94c2

Please sign in to comment.