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. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABCgAGBQJQ5HR+AAoJENaSAD2qAscKg/gQAJSGpz9Frh3QqV30smvbKASI vBcHpbEBMhpExzkcLF3Gqdj7KqcwpN3Nh+oAD1vNyvermeczazEebr5wFfNTv4eE TetUfa2e92RS0c0yxgS+9k1Fhxi8BCovNxmFfiq5iPFHSNwjixPBHLLZVFPCdp9N il/dV8Y7wg1exDikZQc8lqiVULZxvkBc+R/dgXFhAnwFxDMT2jiInXbBU4Onct0P +YX4FwrKnDCOg7bk8Mk/lW6mwAuhoelnuF3dy9v/soBeclOeTfmUmO44dv0D3IPY iGpGofhs+cDSKxOZ0XXocAdFdmY7fbcijppoF00XyZiuqcd59zc0l+LDRuCBcXD7 SFSTzR0uFf8C0rM4Mjfz6WGbwW7Ae0KqLbFIVg03MJDCquOtDBr0Xdpviy1GYNo3 H0Z3400olyGqp/3ZoEjefOoz9DbzqHtzhcMtGBN/ihyaolPJzS81pLTYCsja2SJM pHUjId3abWOVRgtrAk+XUO9Sn6W8Or5bug4+idYwD6LfUILz9OpHin/mplnHoF9F 8lEjhzNHyvU3HQPyR4v/TidExyx7IBeP0tOLk4X2N+fmH45ukl/pPDNfpF/2lxpd mN7HK2H2cYtGrYSwSmwuG0q9W365vmk8mvu2Xz5aIMe9r5SeucgPjzZ3zg+kHgRE OqJljwln6TaSB/7o0MQ5 =JNeQ -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
007f6c3a63
3 changed files with 14 additions and 6 deletions
|
@ -1935,7 +1935,7 @@ static const unsigned char filename_rev_map[256] = {
|
|||
* @src: Source location for the filename to encode
|
||||
* @src_size: Size of the source in bytes
|
||||
*/
|
||||
void ecryptfs_encode_for_filename(unsigned char *dst, size_t *dst_size,
|
||||
static void ecryptfs_encode_for_filename(unsigned char *dst, size_t *dst_size,
|
||||
unsigned char *src, size_t src_size)
|
||||
{
|
||||
size_t num_blocks;
|
||||
|
|
|
@ -102,12 +102,12 @@ int __init ecryptfs_init_kthread(void)
|
|||
|
||||
void ecryptfs_destroy_kthread(void)
|
||||
{
|
||||
struct ecryptfs_open_req *req;
|
||||
struct ecryptfs_open_req *req, *tmp;
|
||||
|
||||
mutex_lock(&ecryptfs_kthread_ctl.mux);
|
||||
ecryptfs_kthread_ctl.flags |= ECRYPTFS_KTHREAD_ZOMBIE;
|
||||
list_for_each_entry(req, &ecryptfs_kthread_ctl.req_list,
|
||||
kthread_ctl_list) {
|
||||
list_for_each_entry_safe(req, tmp, &ecryptfs_kthread_ctl.req_list,
|
||||
kthread_ctl_list) {
|
||||
list_del(&req->kthread_ctl_list);
|
||||
*req->lower_file = ERR_PTR(-EIO);
|
||||
complete(&req->done);
|
||||
|
|
|
@ -338,7 +338,8 @@ static int ecryptfs_write_begin(struct file *file,
|
|||
if (prev_page_end_size
|
||||
>= i_size_read(page->mapping->host)) {
|
||||
zero_user(page, 0, PAGE_CACHE_SIZE);
|
||||
} else {
|
||||
SetPageUptodate(page);
|
||||
} else if (len < PAGE_CACHE_SIZE) {
|
||||
rc = ecryptfs_decrypt_page(page);
|
||||
if (rc) {
|
||||
printk(KERN_ERR "%s: Error decrypting "
|
||||
|
@ -348,8 +349,8 @@ static int ecryptfs_write_begin(struct file *file,
|
|||
ClearPageUptodate(page);
|
||||
goto out;
|
||||
}
|
||||
SetPageUptodate(page);
|
||||
}
|
||||
SetPageUptodate(page);
|
||||
}
|
||||
}
|
||||
/* 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,
|
|||
}
|
||||
goto out;
|
||||
}
|
||||
if (!PageUptodate(page)) {
|
||||
if (copied < PAGE_CACHE_SIZE) {
|
||||
rc = 0;
|
||||
goto out;
|
||||
}
|
||||
SetPageUptodate(page);
|
||||
}
|
||||
/* Fills in zeros if 'to' goes beyond inode size */
|
||||
rc = fill_zeros_to_end_of_page(page, to);
|
||||
if (rc) {
|
||||
|
|
Loading…
Reference in a new issue