[ 50/79] ecryptfs: fixed msync to flush data

From: Greg Kroah-Hartman
Date: Tue Jun 11 2013 - 16:09:02 EST

3.9-stable review patch. If anyone has any objections, please let me know.


From: Paul Taysom <taysom@xxxxxxxxxxxx>

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 <taysom@xxxxxxxxxxxx>
Signed-off-by: Tyler Hicks <tyhicks@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

fs/ecryptfs/file.c | 1 +
1 file changed, 1 insertion(+)

--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -294,6 +294,7 @@ static int ecryptfs_release(struct inode
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);

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/