super.c (b32e3dc7860d00124fa432dba09667e647cb9bcc) | super.c (332ab16f830f59e7621ae8eb2c353dc135a316f6) |
---|---|
1/** 2 * eCryptfs: Linux filesystem encryption layer 3 * 4 * Copyright (C) 1997-2003 Erez Zadok 5 * Copyright (C) 2001-2003 Stony Brook University 6 * Copyright (C) 2004-2006 International Business Machines Corp. 7 * Author(s): Michael A. Halcrow <mahalcro@us.ibm.com> 8 * Michael C. Thompson <mcthomps@us.ibm.com> --- 41 unchanged lines hidden (view full) --- 50{ 51 struct ecryptfs_inode_info *inode_info; 52 struct inode *inode = NULL; 53 54 inode_info = kmem_cache_alloc(ecryptfs_inode_info_cache, GFP_KERNEL); 55 if (unlikely(!inode_info)) 56 goto out; 57 ecryptfs_init_crypt_stat(&inode_info->crypt_stat); | 1/** 2 * eCryptfs: Linux filesystem encryption layer 3 * 4 * Copyright (C) 1997-2003 Erez Zadok 5 * Copyright (C) 2001-2003 Stony Brook University 6 * Copyright (C) 2004-2006 International Business Machines Corp. 7 * Author(s): Michael A. Halcrow <mahalcro@us.ibm.com> 8 * Michael C. Thompson <mcthomps@us.ibm.com> --- 41 unchanged lines hidden (view full) --- 50{ 51 struct ecryptfs_inode_info *inode_info; 52 struct inode *inode = NULL; 53 54 inode_info = kmem_cache_alloc(ecryptfs_inode_info_cache, GFP_KERNEL); 55 if (unlikely(!inode_info)) 56 goto out; 57 ecryptfs_init_crypt_stat(&inode_info->crypt_stat); |
58 mutex_init(&inode_info->lower_file_mutex); 59 atomic_set(&inode_info->lower_file_count, 0); |
|
58 inode_info->lower_file = NULL; 59 inode = &inode_info->vfs_inode; 60out: 61 return inode; 62} 63 64static void ecryptfs_i_callback(struct rcu_head *head) 65{ --- 6 unchanged lines hidden (view full) --- 72} 73 74/** 75 * ecryptfs_destroy_inode 76 * @inode: The ecryptfs inode 77 * 78 * This is used during the final destruction of the inode. All 79 * allocation of memory related to the inode, including allocated | 60 inode_info->lower_file = NULL; 61 inode = &inode_info->vfs_inode; 62out: 63 return inode; 64} 65 66static void ecryptfs_i_callback(struct rcu_head *head) 67{ --- 6 unchanged lines hidden (view full) --- 74} 75 76/** 77 * ecryptfs_destroy_inode 78 * @inode: The ecryptfs inode 79 * 80 * This is used during the final destruction of the inode. All 81 * allocation of memory related to the inode, including allocated |
80 * memory in the crypt_stat struct, will be released here. This 81 * function also fput()'s the persistent file for the lower inode. | 82 * memory in the crypt_stat struct, will be released here. |
82 * There should be no chance that this deallocation will be missed. 83 */ 84static void ecryptfs_destroy_inode(struct inode *inode) 85{ 86 struct ecryptfs_inode_info *inode_info; 87 88 inode_info = ecryptfs_inode_to_private(inode); | 83 * There should be no chance that this deallocation will be missed. 84 */ 85static void ecryptfs_destroy_inode(struct inode *inode) 86{ 87 struct ecryptfs_inode_info *inode_info; 88 89 inode_info = ecryptfs_inode_to_private(inode); |
89 if (inode_info->lower_file) { 90 struct dentry *lower_dentry = 91 inode_info->lower_file->f_dentry; 92 93 BUG_ON(!lower_dentry); 94 if (lower_dentry->d_inode) { 95 fput(inode_info->lower_file); 96 inode_info->lower_file = NULL; 97 } 98 } | 90 BUG_ON(inode_info->lower_file); |
99 ecryptfs_destroy_crypt_stat(&inode_info->crypt_stat); 100 call_rcu(&inode->i_rcu, ecryptfs_i_callback); 101} 102 103/** 104 * ecryptfs_init_inode 105 * @inode: The ecryptfs inode 106 * --- 99 unchanged lines hidden --- | 91 ecryptfs_destroy_crypt_stat(&inode_info->crypt_stat); 92 call_rcu(&inode->i_rcu, ecryptfs_i_callback); 93} 94 95/** 96 * ecryptfs_init_inode 97 * @inode: The ecryptfs inode 98 * --- 99 unchanged lines hidden --- |