diff options
author | Michael Halcrow <mhalcrow@us.ibm.com> | 2007-10-16 04:28:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:12 -0400 |
commit | 16a72c455a67bb23eed7292a31c6ba17729e78e6 (patch) | |
tree | d2cc7d116730348375ce0d06ad45e24744cd0b5f /fs/ecryptfs/crypto.c | |
parent | ecbdc93639f69c1f237ccce6a9aaff1e83f1182f (diff) |
ecryptfs: clean up page flag handling
The functions that eventually call down to ecryptfs_read_lower(),
ecryptfs_decrypt_page(), and ecryptfs_copy_up_encrypted_with_header()
should have the responsibility of managing the page Uptodate
status. This patch gets rid of some of the ugliness that resulted from
trying to push some of the page flag setting too far down the stack.
Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ecryptfs/crypto.c')
-rw-r--r-- | fs/ecryptfs/crypto.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index e890d596da7e..1ae90ef2c74d 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
@@ -605,14 +605,14 @@ int ecryptfs_decrypt_page(struct page *page) | |||
605 | printk(KERN_ERR "%s: Error attempting to copy " | 605 | printk(KERN_ERR "%s: Error attempting to copy " |
606 | "page at index [%ld]\n", __FUNCTION__, | 606 | "page at index [%ld]\n", __FUNCTION__, |
607 | page->index); | 607 | page->index); |
608 | goto out_clear_uptodate; | 608 | goto out; |
609 | } | 609 | } |
610 | enc_extent_virt = kmalloc(PAGE_CACHE_SIZE, GFP_USER); | 610 | enc_extent_virt = kmalloc(PAGE_CACHE_SIZE, GFP_USER); |
611 | if (!enc_extent_virt) { | 611 | if (!enc_extent_virt) { |
612 | rc = -ENOMEM; | 612 | rc = -ENOMEM; |
613 | ecryptfs_printk(KERN_ERR, "Error allocating memory for " | 613 | ecryptfs_printk(KERN_ERR, "Error allocating memory for " |
614 | "encrypted extent\n"); | 614 | "encrypted extent\n"); |
615 | goto out_clear_uptodate; | 615 | goto out; |
616 | } | 616 | } |
617 | enc_extent_page = virt_to_page(enc_extent_virt); | 617 | enc_extent_page = virt_to_page(enc_extent_virt); |
618 | for (extent_offset = 0; | 618 | for (extent_offset = 0; |
@@ -631,21 +631,17 @@ int ecryptfs_decrypt_page(struct page *page) | |||
631 | ecryptfs_printk(KERN_ERR, "Error attempting " | 631 | ecryptfs_printk(KERN_ERR, "Error attempting " |
632 | "to read lower page; rc = [%d]" | 632 | "to read lower page; rc = [%d]" |
633 | "\n", rc); | 633 | "\n", rc); |
634 | goto out_clear_uptodate; | 634 | goto out; |
635 | } | 635 | } |
636 | rc = ecryptfs_decrypt_extent(page, crypt_stat, enc_extent_page, | 636 | rc = ecryptfs_decrypt_extent(page, crypt_stat, enc_extent_page, |
637 | extent_offset); | 637 | extent_offset); |
638 | if (rc) { | 638 | if (rc) { |
639 | printk(KERN_ERR "%s: Error encrypting extent; " | 639 | printk(KERN_ERR "%s: Error encrypting extent; " |
640 | "rc = [%d]\n", __FUNCTION__, rc); | 640 | "rc = [%d]\n", __FUNCTION__, rc); |
641 | goto out_clear_uptodate; | 641 | goto out; |
642 | } | 642 | } |
643 | extent_offset++; | 643 | extent_offset++; |
644 | } | 644 | } |
645 | SetPageUptodate(page); | ||
646 | goto out; | ||
647 | out_clear_uptodate: | ||
648 | ClearPageUptodate(page); | ||
649 | out: | 645 | out: |
650 | kfree(enc_extent_virt); | 646 | kfree(enc_extent_virt); |
651 | return rc; | 647 | return rc; |