]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ecryptfs: fixed msync to flush data
authorPaul Taysom <taysom@chromium.org>
Thu, 23 May 2013 21:31:43 +0000 (14:31 -0700)
committerTyler Hicks <tyhicks@canonical.com>
Fri, 24 May 2013 23:21:45 +0000 (16:21 -0700)
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@chromium.org>
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Cc: stable@vger.kernel.org # v3.6+
fs/ecryptfs/file.c

index 201f0a0d6b0a2a2be8a2983d2fb63ef27dacc0d8..16f509d6fa4957930670d1b245195b0591ac4df8 100644 (file)
@@ -295,6 +295,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);
 }