aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-01-02 20:33:50 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-01-02 20:33:50 -0500
commit007f6c3a63e0831ff5a34bde072db08e917134c8 (patch)
treef9c7b1cbd91f719165ce97463652c66ee81d3704
parent58890c06691462ca29900d1116b28c7a3e131252 (diff)
parent37028758f92d0a3eb74bcfbecf6bc477072e9e28 (diff)
Merge tag 'ecryptfs-3.8-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs
Pull ecryptfs fixes from Tyler Hicks: "Two self-explanatory fixes and a third patch which improves performance: when overwriting a full page in the eCryptfs page cache, skip reading in and decrypting the corresponding lower page." * tag 'ecryptfs-3.8-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs: fs/ecryptfs/crypto.c: make ecryptfs_encode_for_filename() static eCryptfs: fix to use list_for_each_entry_safe() when delete items eCryptfs: Avoid unnecessary disk read and data decryption during writing
-rw-r--r--fs/ecryptfs/crypto.c2
-rw-r--r--fs/ecryptfs/kthread.c6
-rw-r--r--fs/ecryptfs/mmap.c12
3 files changed, 14 insertions, 6 deletions
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index ea9931281557..a7b0c2dfb3db 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -1935,7 +1935,7 @@ static const unsigned char filename_rev_map[256] = {
1935 * @src: Source location for the filename to encode 1935 * @src: Source location for the filename to encode
1936 * @src_size: Size of the source in bytes 1936 * @src_size: Size of the source in bytes
1937 */ 1937 */
1938void ecryptfs_encode_for_filename(unsigned char *dst, size_t *dst_size, 1938static void ecryptfs_encode_for_filename(unsigned char *dst, size_t *dst_size,
1939 unsigned char *src, size_t src_size) 1939 unsigned char *src, size_t src_size)
1940{ 1940{
1941 size_t num_blocks; 1941 size_t num_blocks;
diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c
index 809e67d05ca3..f1ea610362c6 100644
--- a/fs/ecryptfs/kthread.c
+++ b/fs/ecryptfs/kthread.c
@@ -102,12 +102,12 @@ int __init ecryptfs_init_kthread(void)
102 102
103void ecryptfs_destroy_kthread(void) 103void ecryptfs_destroy_kthread(void)
104{ 104{
105 struct ecryptfs_open_req *req; 105 struct ecryptfs_open_req *req, *tmp;
106 106
107 mutex_lock(&ecryptfs_kthread_ctl.mux); 107 mutex_lock(&ecryptfs_kthread_ctl.mux);
108 ecryptfs_kthread_ctl.flags |= ECRYPTFS_KTHREAD_ZOMBIE; 108 ecryptfs_kthread_ctl.flags |= ECRYPTFS_KTHREAD_ZOMBIE;
109 list_for_each_entry(req, &ecryptfs_kthread_ctl.req_list, 109 list_for_each_entry_safe(req, tmp, &ecryptfs_kthread_ctl.req_list,
110 kthread_ctl_list) { 110 kthread_ctl_list) {
111 list_del(&req->kthread_ctl_list); 111 list_del(&req->kthread_ctl_list);
112 *req->lower_file = ERR_PTR(-EIO); 112 *req->lower_file = ERR_PTR(-EIO);
113 complete(&req->done); 113 complete(&req->done);
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index bd1d57f98f74..564a1fa34b99 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -338,7 +338,8 @@ static int ecryptfs_write_begin(struct file *file,
338 if (prev_page_end_size 338 if (prev_page_end_size
339 >= i_size_read(page->mapping->host)) { 339 >= i_size_read(page->mapping->host)) {
340 zero_user(page, 0, PAGE_CACHE_SIZE); 340 zero_user(page, 0, PAGE_CACHE_SIZE);
341 } else { 341 SetPageUptodate(page);
342 } else if (len < PAGE_CACHE_SIZE) {
342 rc = ecryptfs_decrypt_page(page); 343 rc = ecryptfs_decrypt_page(page);
343 if (rc) { 344 if (rc) {
344 printk(KERN_ERR "%s: Error decrypting " 345 printk(KERN_ERR "%s: Error decrypting "
@@ -348,8 +349,8 @@ static int ecryptfs_write_begin(struct file *file,
348 ClearPageUptodate(page); 349 ClearPageUptodate(page);
349 goto out; 350 goto out;
350 } 351 }
352 SetPageUptodate(page);
351 } 353 }
352 SetPageUptodate(page);
353 } 354 }
354 } 355 }
355 /* If creating a page or more of holes, zero them out via truncate. 356 /* If creating a page or more of holes, zero them out via truncate.
@@ -499,6 +500,13 @@ static int ecryptfs_write_end(struct file *file,
499 } 500 }
500 goto out; 501 goto out;
501 } 502 }
503 if (!PageUptodate(page)) {
504 if (copied < PAGE_CACHE_SIZE) {
505 rc = 0;
506 goto out;
507 }
508 SetPageUptodate(page);
509 }
502 /* Fills in zeros if 'to' goes beyond inode size */ 510 /* Fills in zeros if 'to' goes beyond inode size */
503 rc = fill_zeros_to_end_of_page(page, to); 511 rc = fill_zeros_to_end_of_page(page, to);
504 if (rc) { 512 if (rc) {