diff options
Diffstat (limited to 'fs/ecryptfs/mmap.c')
-rw-r--r-- | fs/ecryptfs/mmap.c | 12 |
1 files changed, 10 insertions, 2 deletions
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) { |