diff options
Diffstat (limited to 'fs/ecryptfs/inode.c')
-rw-r--r-- | fs/ecryptfs/inode.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index f6b388638c3..2c19d362d2d 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -225,10 +225,8 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, | |||
225 | struct dentry *lower_dir_dentry; | 225 | struct dentry *lower_dir_dentry; |
226 | struct vfsmount *lower_mnt; | 226 | struct vfsmount *lower_mnt; |
227 | struct inode *lower_inode; | 227 | struct inode *lower_inode; |
228 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat; | ||
229 | struct ecryptfs_crypt_stat *crypt_stat; | 228 | struct ecryptfs_crypt_stat *crypt_stat; |
230 | char *page_virt = NULL; | 229 | char *page_virt = NULL; |
231 | u64 file_size; | ||
232 | int put_lower = 0, rc = 0; | 230 | int put_lower = 0, rc = 0; |
233 | 231 | ||
234 | lower_dir_dentry = lower_dentry->d_parent; | 232 | lower_dir_dentry = lower_dentry->d_parent; |
@@ -302,18 +300,7 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, | |||
302 | } | 300 | } |
303 | crypt_stat->flags |= ECRYPTFS_METADATA_IN_XATTR; | 301 | crypt_stat->flags |= ECRYPTFS_METADATA_IN_XATTR; |
304 | } | 302 | } |
305 | mount_crypt_stat = &ecryptfs_superblock_to_private( | 303 | ecryptfs_i_size_init(page_virt, ecryptfs_dentry->d_inode); |
306 | ecryptfs_dentry->d_sb)->mount_crypt_stat; | ||
307 | if (mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED) { | ||
308 | if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) | ||
309 | file_size = (crypt_stat->metadata_size | ||
310 | + i_size_read(lower_dentry->d_inode)); | ||
311 | else | ||
312 | file_size = i_size_read(lower_dentry->d_inode); | ||
313 | } else { | ||
314 | file_size = get_unaligned_be64(page_virt); | ||
315 | } | ||
316 | i_size_write(ecryptfs_dentry->d_inode, (loff_t)file_size); | ||
317 | out_free_kmem: | 304 | out_free_kmem: |
318 | kmem_cache_free(ecryptfs_header_cache_2, page_virt); | 305 | kmem_cache_free(ecryptfs_header_cache_2, page_virt); |
319 | goto out; | 306 | goto out; |
@@ -937,7 +924,8 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) | |||
937 | goto out; | 924 | goto out; |
938 | } | 925 | } |
939 | rc = 0; | 926 | rc = 0; |
940 | crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED); | 927 | crypt_stat->flags &= ~(ECRYPTFS_I_SIZE_INITIALIZED |
928 | | ECRYPTFS_ENCRYPTED); | ||
941 | } | 929 | } |
942 | } | 930 | } |
943 | mutex_unlock(&crypt_stat->cs_mutex); | 931 | mutex_unlock(&crypt_stat->cs_mutex); |