From 230580467f6ccb3fca4073948e22809a807f9c50 Mon Sep 17 00:00:00 2001 From: Tyler Hicks Date: Mon, 21 Nov 2011 17:31:29 -0600 Subject: [PATCH] --- yaml --- r: 275922 b: refs/heads/master c: 32001d6fe9ac6b0423e674a3093aa56740849f3b h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/ecryptfs/file.c | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 6ce9a2433dfd..25fe97fc6e81 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b59db43ad4434519feb338eacb01d77eb50825c5 +refs/heads/master: 32001d6fe9ac6b0423e674a3093aa56740849f3b diff --git a/trunk/fs/ecryptfs/file.c b/trunk/fs/ecryptfs/file.c index c6ac98cf9baa..d3f95f941c47 100644 --- a/trunk/fs/ecryptfs/file.c +++ b/trunk/fs/ecryptfs/file.c @@ -139,6 +139,27 @@ static int ecryptfs_readdir(struct file *file, void *dirent, filldir_t filldir) return rc; } +static void ecryptfs_vma_close(struct vm_area_struct *vma) +{ + filemap_write_and_wait(vma->vm_file->f_mapping); +} + +static const struct vm_operations_struct ecryptfs_file_vm_ops = { + .close = ecryptfs_vma_close, + .fault = filemap_fault, +}; + +static int ecryptfs_file_mmap(struct file *file, struct vm_area_struct *vma) +{ + int rc; + + rc = generic_file_mmap(file, vma); + if (!rc) + vma->vm_ops = &ecryptfs_file_vm_ops; + + return rc; +} + struct kmem_cache *ecryptfs_file_info_cache; /** @@ -349,7 +370,7 @@ const struct file_operations ecryptfs_main_fops = { #ifdef CONFIG_COMPAT .compat_ioctl = ecryptfs_compat_ioctl, #endif - .mmap = generic_file_mmap, + .mmap = ecryptfs_file_mmap, .open = ecryptfs_open, .flush = ecryptfs_flush, .release = ecryptfs_release,