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>
This commit is contained in:

committed by
Linus Torvalds

parent
ecbdc93639
commit
16a72c455a
@@ -605,14 +605,14 @@ int ecryptfs_decrypt_page(struct page *page)
|
||||
printk(KERN_ERR "%s: Error attempting to copy "
|
||||
"page at index [%ld]\n", __FUNCTION__,
|
||||
page->index);
|
||||
goto out_clear_uptodate;
|
||||
goto out;
|
||||
}
|
||||
enc_extent_virt = kmalloc(PAGE_CACHE_SIZE, GFP_USER);
|
||||
if (!enc_extent_virt) {
|
||||
rc = -ENOMEM;
|
||||
ecryptfs_printk(KERN_ERR, "Error allocating memory for "
|
||||
"encrypted extent\n");
|
||||
goto out_clear_uptodate;
|
||||
goto out;
|
||||
}
|
||||
enc_extent_page = virt_to_page(enc_extent_virt);
|
||||
for (extent_offset = 0;
|
||||
@@ -631,21 +631,17 @@ int ecryptfs_decrypt_page(struct page *page)
|
||||
ecryptfs_printk(KERN_ERR, "Error attempting "
|
||||
"to read lower page; rc = [%d]"
|
||||
"\n", rc);
|
||||
goto out_clear_uptodate;
|
||||
goto out;
|
||||
}
|
||||
rc = ecryptfs_decrypt_extent(page, crypt_stat, enc_extent_page,
|
||||
extent_offset);
|
||||
if (rc) {
|
||||
printk(KERN_ERR "%s: Error encrypting extent; "
|
||||
"rc = [%d]\n", __FUNCTION__, rc);
|
||||
goto out_clear_uptodate;
|
||||
goto out;
|
||||
}
|
||||
extent_offset++;
|
||||
}
|
||||
SetPageUptodate(page);
|
||||
goto out;
|
||||
out_clear_uptodate:
|
||||
ClearPageUptodate(page);
|
||||
out:
|
||||
kfree(enc_extent_virt);
|
||||
return rc;
|
||||
|
Reference in New Issue
Block a user