aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ecryptfs')
-rw-r--r--fs/ecryptfs/inode.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 31ef5252f0fe..82900b063b1e 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -804,10 +804,20 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia,
804 size_t num_zeros = (PAGE_CACHE_SIZE 804 size_t num_zeros = (PAGE_CACHE_SIZE
805 - (ia->ia_size & ~PAGE_CACHE_MASK)); 805 - (ia->ia_size & ~PAGE_CACHE_MASK));
806 806
807
808 /*
809 * XXX(truncate) this should really happen at the begginning
810 * of ->setattr. But the code is too messy to that as part
811 * of a larger patch. ecryptfs is also totally missing out
812 * on the inode_change_ok check at the beginning of
813 * ->setattr while would include this.
814 */
815 rc = inode_newsize_ok(inode, ia->ia_size);
816 if (rc)
817 goto out;
818
807 if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) { 819 if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) {
808 rc = simple_setsize(inode, ia->ia_size); 820 truncate_setsize(inode, ia->ia_size);
809 if (rc)
810 goto out;
811 lower_ia->ia_size = ia->ia_size; 821 lower_ia->ia_size = ia->ia_size;
812 lower_ia->ia_valid |= ATTR_SIZE; 822 lower_ia->ia_valid |= ATTR_SIZE;
813 goto out; 823 goto out;
@@ -830,7 +840,7 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia,
830 goto out; 840 goto out;
831 } 841 }
832 } 842 }
833 simple_setsize(inode, ia->ia_size); 843 truncate_setsize(inode, ia->ia_size);
834 rc = ecryptfs_write_inode_size_to_metadata(inode); 844 rc = ecryptfs_write_inode_size_to_metadata(inode);
835 if (rc) { 845 if (rc) {
836 printk(KERN_ERR "Problem with " 846 printk(KERN_ERR "Problem with "