Skip to content

Commit 78cee20

Browse files
jankaragregkh
authored andcommitted
ext4: fix mmap data corruption when blocksize < pagesize
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: Greg Kroah-Hartman <[email protected]>
1 parent 95fda60 commit 78cee20

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/ext4/inode.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4645,8 +4645,12 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
46454645
ext4_orphan_del(NULL, inode);
46464646
goto err_out;
46474647
}
4648-
} else
4648+
} else {
4649+
loff_t oldsize = inode->i_size;
4650+
46494651
i_size_write(inode, attr->ia_size);
4652+
pagecache_isize_extended(inode, oldsize, inode->i_size);
4653+
}
46504654

46514655
/*
46524656
* Blocks are going to be removed from the inode. Wait

0 commit comments

Comments
 (0)