Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
fork

Configure Feed

Select the types of activity you want to include in your feed.

ext4: fix mmap data corruption in nodelalloc mode when blocksize < pagesize

Since commit 90a8020 and d6320cb, Jan Kara has fixed this issue partially.
This mmap data corruption still exists in nodelalloc mode, fix this.

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>

authored by

Xiaoguang Wang and committed by
Theodore Ts'o
0572639f 2cb5cc8b

+7
+7
fs/ext4/inode.c
··· 1007 1007 { 1008 1008 handle_t *handle = ext4_journal_current_handle(); 1009 1009 struct inode *inode = mapping->host; 1010 + loff_t old_size = inode->i_size; 1010 1011 int ret = 0, ret2; 1011 1012 int i_size_changed = 0; 1012 1013 ··· 1038 1037 unlock_page(page); 1039 1038 page_cache_release(page); 1040 1039 1040 + if (old_size < pos) 1041 + pagecache_isize_extended(inode, old_size, pos); 1041 1042 /* 1042 1043 * Don't mark the inode dirty under page lock. First, it unnecessarily 1043 1044 * makes the holding time of page lock longer. Second, it forces lock ··· 1081 1078 { 1082 1079 handle_t *handle = ext4_journal_current_handle(); 1083 1080 struct inode *inode = mapping->host; 1081 + loff_t old_size = inode->i_size; 1084 1082 int ret = 0, ret2; 1085 1083 int partial = 0; 1086 1084 unsigned from, to; ··· 1113 1109 EXT4_I(inode)->i_datasync_tid = handle->h_transaction->t_tid; 1114 1110 unlock_page(page); 1115 1111 page_cache_release(page); 1112 + 1113 + if (old_size < pos) 1114 + pagecache_isize_extended(inode, old_size, pos); 1116 1115 1117 1116 if (size_changed) { 1118 1117 ret2 = ext4_mark_inode_dirty(handle, inode);