[Devel] [PATCH rh7 3/3] ext4: fix mmap data corruption when blocksize < pagesize

Dmitry Monakhov dmonakhov at openvz.org
Wed Jul 1 07:46:47 PDT 2015


Cyrill Gorcunov <gorcunov at virtuozzo.com> writes:

> 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>
ACK
> ---
>  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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://lists.openvz.org/pipermail/devel/attachments/20150701/c827d68d/attachment-0001.sig>


More information about the Devel mailing list