[Devel] [PATCH RHEL7 COMMIT] ms/ext4: fix mmap data corruption when blocksize < pagesize

Konstantin Khorenko khorenko at virtuozzo.com
Tue Jun 30 07:16:03 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.23
------>
commit cf51e5c00bea66c2db59cc0ff1358b38f5472b69
Author: Jan Kara <jack at suse.cz>
Date:   Tue Jun 30 18:16:03 2015 +0400

    ms/ext4: fix mmap data corruption when blocksize < pagesize
    
    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(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 1028c40..2b059101 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4849,8 +4849,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



More information about the Devel mailing list