1 ext4: fix mmap data corruption when blocksize < pagesize
3 From: Jan Kara <jack@suse.cz>
5 Use truncate_isize_extended() when hole is being created in a file so that
6 ->page_mkwrite() will get called for the partial tail page if it is
7 mmaped (see the first patch in the series for details).
9 Signed-off-by: Jan Kara <jack@suse.cz>
10 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 fs/ext4/inode.c | 6 +++++-
13 1 file changed, 5 insertions(+), 1 deletion(-)
15 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
16 index 3aa26e9117c4..9e269489e094 100644
19 @@ -4536,8 +4536,12 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
20 ext4_orphan_del(NULL, inode);
25 + loff_t oldsize = inode->i_size;
27 i_size_write(inode, attr->ia_size);
28 + pagecache_isize_extended(inode, oldsize, inode->i_size);
32 * Blocks are going to be removed from the inode. Wait
37 To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
38 the body of a message to majordomo@vger.kernel.org
39 More majordomo info at http://vger.kernel.org/majordomo-info.html