diff options
Diffstat (limited to 'fs/ecryptfs/mmap.c')
-rw-r--r-- | fs/ecryptfs/mmap.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c index 46cec2b69796..5c6bab9786e3 100644 --- a/fs/ecryptfs/mmap.c +++ b/fs/ecryptfs/mmap.c | |||
@@ -449,6 +449,7 @@ int ecryptfs_write_inode_size_to_metadata(struct inode *ecryptfs_inode) | |||
449 | struct ecryptfs_crypt_stat *crypt_stat; | 449 | struct ecryptfs_crypt_stat *crypt_stat; |
450 | 450 | ||
451 | crypt_stat = &ecryptfs_inode_to_private(ecryptfs_inode)->crypt_stat; | 451 | crypt_stat = &ecryptfs_inode_to_private(ecryptfs_inode)->crypt_stat; |
452 | BUG_ON(!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)); | ||
452 | if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) | 453 | if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) |
453 | return ecryptfs_write_inode_size_to_xattr(ecryptfs_inode); | 454 | return ecryptfs_write_inode_size_to_xattr(ecryptfs_inode); |
454 | else | 455 | else |
@@ -490,6 +491,16 @@ static int ecryptfs_write_end(struct file *file, | |||
490 | ecryptfs_printk(KERN_DEBUG, "Not a new file\n"); | 491 | ecryptfs_printk(KERN_DEBUG, "Not a new file\n"); |
491 | ecryptfs_printk(KERN_DEBUG, "Calling fill_zeros_to_end_of_page" | 492 | ecryptfs_printk(KERN_DEBUG, "Calling fill_zeros_to_end_of_page" |
492 | "(page w/ index = [0x%.16x], to = [%d])\n", index, to); | 493 | "(page w/ index = [0x%.16x], to = [%d])\n", index, to); |
494 | if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) { | ||
495 | rc = ecryptfs_write_lower_page_segment(ecryptfs_inode, page, 0, | ||
496 | to); | ||
497 | if (!rc) { | ||
498 | rc = copied; | ||
499 | fsstack_copy_inode_size(ecryptfs_inode, | ||
500 | ecryptfs_inode_to_lower(ecryptfs_inode)); | ||
501 | } | ||
502 | goto out; | ||
503 | } | ||
493 | /* Fills in zeros if 'to' goes beyond inode size */ | 504 | /* Fills in zeros if 'to' goes beyond inode size */ |
494 | rc = fill_zeros_to_end_of_page(page, to); | 505 | rc = fill_zeros_to_end_of_page(page, to); |
495 | if (rc) { | 506 | if (rc) { |