[Devel] [PATCH rh7 3/3] ext4: fix mmap data corruption when blocksize < pagesize
Cyrill Gorcunov
gorcunov at virtuozzo.com
Tue Jun 30 04:08:39 PDT 2015
From: Jan Kara <jack at suse.cz>
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).
gorcunov@:
- ML d6320cbfc92910a3e5f10c42d98c231c98db4f60
- https://jira.sw.ru/browse/PSBM-34383
Signed-off-by: Jan Kara <jack at suse.cz>
Signed-off-by: Theodore Ts'o <tytso at mit.edu>
Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
---
fs/ext4/inode.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Index: linux-pcs7.git/fs/ext4/inode.c
===================================================================
--- linux-pcs7.git.orig/fs/ext4/inode.c
+++ linux-pcs7.git/fs/ext4/inode.c
@@ -4849,8 +4849,12 @@ int ext4_setattr(struct dentry *dentry,
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
More information about the Devel
mailing list