Commit 0a9ac382 authored by Michael Halcrow's avatar Michael Halcrow Committed by Linus Torvalds

[PATCH] eCryptfs: add flush_dcache_page() calls

Call flush_dcache_page() after modifying a pagecache by hand.
Signed-off-by: default avatarMichael Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e2bd99ec
...@@ -238,7 +238,9 @@ int ecryptfs_do_readpage(struct file *file, struct page *page, ...@@ -238,7 +238,9 @@ int ecryptfs_do_readpage(struct file *file, struct page *page,
lower_page_data = kmap_atomic(lower_page, KM_USER1); lower_page_data = kmap_atomic(lower_page, KM_USER1);
memcpy(page_data, lower_page_data, PAGE_CACHE_SIZE); memcpy(page_data, lower_page_data, PAGE_CACHE_SIZE);
kunmap_atomic(lower_page_data, KM_USER1); kunmap_atomic(lower_page_data, KM_USER1);
flush_dcache_page(lower_page);
kunmap_atomic(page_data, KM_USER0); kunmap_atomic(page_data, KM_USER0);
flush_dcache_page(page);
rc = 0; rc = 0;
out: out:
if (likely(lower_page)) if (likely(lower_page))
...@@ -322,6 +324,7 @@ static int ecryptfs_readpage(struct file *file, struct page *page) ...@@ -322,6 +324,7 @@ static int ecryptfs_readpage(struct file *file, struct page *page)
set_header_info(page_virt, crypt_stat); set_header_info(page_virt, crypt_stat);
} }
kunmap_atomic(page_virt, KM_USER0); kunmap_atomic(page_virt, KM_USER0);
flush_dcache_page(page);
if (rc) { if (rc) {
printk(KERN_ERR "Error reading xattr " printk(KERN_ERR "Error reading xattr "
"region\n"); "region\n");
...@@ -382,6 +385,7 @@ static int fill_zeros_to_end_of_page(struct page *page, unsigned int to) ...@@ -382,6 +385,7 @@ static int fill_zeros_to_end_of_page(struct page *page, unsigned int to)
memset((page_virt + end_byte_in_page), 0, memset((page_virt + end_byte_in_page), 0,
(PAGE_CACHE_SIZE - end_byte_in_page)); (PAGE_CACHE_SIZE - end_byte_in_page));
kunmap_atomic(page_virt, KM_USER0); kunmap_atomic(page_virt, KM_USER0);
flush_dcache_page(page);
out: out:
return 0; return 0;
} }
...@@ -456,6 +460,7 @@ static int ecryptfs_write_inode_size_to_header(struct file *lower_file, ...@@ -456,6 +460,7 @@ static int ecryptfs_write_inode_size_to_header(struct file *lower_file,
header_virt = kmap_atomic(header_page, KM_USER0); header_virt = kmap_atomic(header_page, KM_USER0);
memcpy(header_virt, &file_size, sizeof(u64)); memcpy(header_virt, &file_size, sizeof(u64));
kunmap_atomic(header_virt, KM_USER0); kunmap_atomic(header_virt, KM_USER0);
flush_dcache_page(header_page);
rc = lower_a_ops->commit_write(lower_file, header_page, 0, 8); rc = lower_a_ops->commit_write(lower_file, header_page, 0, 8);
if (rc < 0) if (rc < 0)
ecryptfs_printk(KERN_ERR, "Error commiting header page " ecryptfs_printk(KERN_ERR, "Error commiting header page "
...@@ -742,6 +747,7 @@ int write_zeros(struct file *file, pgoff_t index, int start, int num_zeros) ...@@ -742,6 +747,7 @@ int write_zeros(struct file *file, pgoff_t index, int start, int num_zeros)
tmp_page_virt = kmap_atomic(tmp_page, KM_USER0); tmp_page_virt = kmap_atomic(tmp_page, KM_USER0);
memset(((char *)tmp_page_virt + start), 0, num_zeros); memset(((char *)tmp_page_virt + start), 0, num_zeros);
kunmap_atomic(tmp_page_virt, KM_USER0); kunmap_atomic(tmp_page_virt, KM_USER0);
flush_dcache_page(tmp_page);
rc = ecryptfs_commit_write(file, tmp_page, start, start + num_zeros); rc = ecryptfs_commit_write(file, tmp_page, start, start + num_zeros);
if (rc < 0) { if (rc < 0) {
ecryptfs_printk(KERN_ERR, "Error attempting to write zero's " ecryptfs_printk(KERN_ERR, "Error attempting to write zero's "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment