diff options
Diffstat (limited to 'fs/ecryptfs/super.c')
-rw-r--r-- | fs/ecryptfs/super.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/fs/ecryptfs/super.c b/fs/ecryptfs/super.c index 3042fe123a34..245b517bf1b6 100644 --- a/fs/ecryptfs/super.c +++ b/fs/ecryptfs/super.c | |||
@@ -56,6 +56,7 @@ static struct inode *ecryptfs_alloc_inode(struct super_block *sb) | |||
56 | goto out; | 56 | goto out; |
57 | ecryptfs_init_crypt_stat(&inode_info->crypt_stat); | 57 | ecryptfs_init_crypt_stat(&inode_info->crypt_stat); |
58 | mutex_init(&inode_info->lower_file_mutex); | 58 | mutex_init(&inode_info->lower_file_mutex); |
59 | atomic_set(&inode_info->lower_file_count, 0); | ||
59 | inode_info->lower_file = NULL; | 60 | inode_info->lower_file = NULL; |
60 | inode = &inode_info->vfs_inode; | 61 | inode = &inode_info->vfs_inode; |
61 | out: | 62 | out: |
@@ -78,8 +79,7 @@ static void ecryptfs_i_callback(struct rcu_head *head) | |||
78 | * | 79 | * |
79 | * This is used during the final destruction of the inode. All | 80 | * This is used during the final destruction of the inode. All |
80 | * allocation of memory related to the inode, including allocated | 81 | * allocation of memory related to the inode, including allocated |
81 | * memory in the crypt_stat struct, will be released here. This | 82 | * memory in the crypt_stat struct, will be released here. |
82 | * function also fput()'s the persistent file for the lower inode. | ||
83 | * There should be no chance that this deallocation will be missed. | 83 | * There should be no chance that this deallocation will be missed. |
84 | */ | 84 | */ |
85 | static void ecryptfs_destroy_inode(struct inode *inode) | 85 | static void ecryptfs_destroy_inode(struct inode *inode) |
@@ -87,16 +87,7 @@ static void ecryptfs_destroy_inode(struct inode *inode) | |||
87 | struct ecryptfs_inode_info *inode_info; | 87 | struct ecryptfs_inode_info *inode_info; |
88 | 88 | ||
89 | inode_info = ecryptfs_inode_to_private(inode); | 89 | inode_info = ecryptfs_inode_to_private(inode); |
90 | if (inode_info->lower_file) { | 90 | BUG_ON(inode_info->lower_file); |
91 | struct dentry *lower_dentry = | ||
92 | inode_info->lower_file->f_dentry; | ||
93 | |||
94 | BUG_ON(!lower_dentry); | ||
95 | if (lower_dentry->d_inode) { | ||
96 | fput(inode_info->lower_file); | ||
97 | inode_info->lower_file = NULL; | ||
98 | } | ||
99 | } | ||
100 | ecryptfs_destroy_crypt_stat(&inode_info->crypt_stat); | 91 | ecryptfs_destroy_crypt_stat(&inode_info->crypt_stat); |
101 | call_rcu(&inode->i_rcu, ecryptfs_i_callback); | 92 | call_rcu(&inode->i_rcu, ecryptfs_i_callback); |
102 | } | 93 | } |
@@ -198,7 +189,7 @@ static int ecryptfs_show_options(struct seq_file *m, struct vfsmount *mnt) | |||
198 | const struct super_operations ecryptfs_sops = { | 189 | const struct super_operations ecryptfs_sops = { |
199 | .alloc_inode = ecryptfs_alloc_inode, | 190 | .alloc_inode = ecryptfs_alloc_inode, |
200 | .destroy_inode = ecryptfs_destroy_inode, | 191 | .destroy_inode = ecryptfs_destroy_inode, |
201 | .drop_inode = generic_delete_inode, | 192 | .drop_inode = generic_drop_inode, |
202 | .statfs = ecryptfs_statfs, | 193 | .statfs = ecryptfs_statfs, |
203 | .remount_fs = NULL, | 194 | .remount_fs = NULL, |
204 | .evict_inode = ecryptfs_evict_inode, | 195 | .evict_inode = ecryptfs_evict_inode, |