From: Paul Taysom Date: Thu, 23 May 2013 21:31:43 +0000 (-0700) Subject: ecryptfs: fixed msync to flush data X-Git-Tag: v3.9.6~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef6190a2ac96fa2156c5e1423d1ea84a1cdf1bda;p=thirdparty%2Fkernel%2Fstable.git ecryptfs: fixed msync to flush data commit c15cddd900e867c5adfb3c79596479dc5975f743 upstream. When msync is called on a memory mapped file, that data is not flushed to the disk. In Linux, msync calls fsync for the file. For ecryptfs, fsync just calls the lower level file system's fsync. Changed the ecryptfs fsync code to call filemap_write_and_wait before calling the lower level fsync. Addresses the problem described in http://crbug.com/239536 Signed-off-by: Paul Taysom Signed-off-by: Tyler Hicks Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index 63b1f54b6a1ff..a19022fe130f0 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c @@ -294,6 +294,7 @@ static int ecryptfs_release(struct inode *inode, struct file *file) static int ecryptfs_fsync(struct file *file, loff_t start, loff_t end, int datasync) { + filemap_write_and_wait(file->f_mapping); return vfs_fsync(ecryptfs_file_to_lower(file), datasync); }