diff options
Diffstat (limited to 'fs/ecryptfs/inode.c')
| -rw-r--r-- | fs/ecryptfs/inode.c | 38 |
1 files changed, 7 insertions, 31 deletions
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 7349ade17de6..11f8582d7218 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
| @@ -69,6 +69,7 @@ static int ecryptfs_inode_set(struct inode *inode, void *opaque) | |||
| 69 | inode->i_ino = lower_inode->i_ino; | 69 | inode->i_ino = lower_inode->i_ino; |
| 70 | inode->i_version++; | 70 | inode->i_version++; |
| 71 | inode->i_mapping->a_ops = &ecryptfs_aops; | 71 | inode->i_mapping->a_ops = &ecryptfs_aops; |
| 72 | inode->i_mapping->backing_dev_info = inode->i_sb->s_bdi; | ||
| 72 | 73 | ||
| 73 | if (S_ISLNK(inode->i_mode)) | 74 | if (S_ISLNK(inode->i_mode)) |
| 74 | inode->i_op = &ecryptfs_symlink_iops; | 75 | inode->i_op = &ecryptfs_symlink_iops; |
| @@ -147,7 +148,6 @@ static int ecryptfs_interpose(struct dentry *lower_dentry, | |||
| 147 | * @lower_dir_inode: inode of the parent in the lower fs of the new file | 148 | * @lower_dir_inode: inode of the parent in the lower fs of the new file |
| 148 | * @dentry: New file's dentry | 149 | * @dentry: New file's dentry |
| 149 | * @mode: The mode of the new file | 150 | * @mode: The mode of the new file |
| 150 | * @nd: nameidata of ecryptfs' parent's dentry & vfsmount | ||
| 151 | * | 151 | * |
| 152 | * Creates the file in the lower file system. | 152 | * Creates the file in the lower file system. |
| 153 | * | 153 | * |
| @@ -155,31 +155,10 @@ static int ecryptfs_interpose(struct dentry *lower_dentry, | |||
| 155 | */ | 155 | */ |
| 156 | static int | 156 | static int |
| 157 | ecryptfs_create_underlying_file(struct inode *lower_dir_inode, | 157 | ecryptfs_create_underlying_file(struct inode *lower_dir_inode, |
| 158 | struct dentry *dentry, int mode, | 158 | struct dentry *dentry, int mode) |
| 159 | struct nameidata *nd) | ||
| 160 | { | 159 | { |
| 161 | struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); | 160 | struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); |
| 162 | struct vfsmount *lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); | 161 | return vfs_create(lower_dir_inode, lower_dentry, mode, NULL); |
| 163 | struct dentry *dentry_save; | ||
| 164 | struct vfsmount *vfsmount_save; | ||
| 165 | unsigned int flags_save; | ||
| 166 | int rc; | ||
| 167 | |||
| 168 | if (nd) { | ||
| 169 | dentry_save = nd->path.dentry; | ||
| 170 | vfsmount_save = nd->path.mnt; | ||
| 171 | flags_save = nd->flags; | ||
| 172 | nd->path.dentry = lower_dentry; | ||
| 173 | nd->path.mnt = lower_mnt; | ||
| 174 | nd->flags &= ~LOOKUP_OPEN; | ||
| 175 | } | ||
| 176 | rc = vfs_create(lower_dir_inode, lower_dentry, mode, nd); | ||
| 177 | if (nd) { | ||
| 178 | nd->path.dentry = dentry_save; | ||
| 179 | nd->path.mnt = vfsmount_save; | ||
| 180 | nd->flags = flags_save; | ||
| 181 | } | ||
| 182 | return rc; | ||
| 183 | } | 162 | } |
| 184 | 163 | ||
| 185 | /** | 164 | /** |
| @@ -197,8 +176,7 @@ ecryptfs_create_underlying_file(struct inode *lower_dir_inode, | |||
| 197 | */ | 176 | */ |
| 198 | static int | 177 | static int |
| 199 | ecryptfs_do_create(struct inode *directory_inode, | 178 | ecryptfs_do_create(struct inode *directory_inode, |
| 200 | struct dentry *ecryptfs_dentry, int mode, | 179 | struct dentry *ecryptfs_dentry, int mode) |
| 201 | struct nameidata *nd) | ||
| 202 | { | 180 | { |
| 203 | int rc; | 181 | int rc; |
| 204 | struct dentry *lower_dentry; | 182 | struct dentry *lower_dentry; |
| @@ -213,7 +191,7 @@ ecryptfs_do_create(struct inode *directory_inode, | |||
| 213 | goto out; | 191 | goto out; |
| 214 | } | 192 | } |
| 215 | rc = ecryptfs_create_underlying_file(lower_dir_dentry->d_inode, | 193 | rc = ecryptfs_create_underlying_file(lower_dir_dentry->d_inode, |
| 216 | ecryptfs_dentry, mode, nd); | 194 | ecryptfs_dentry, mode); |
| 217 | if (rc) { | 195 | if (rc) { |
| 218 | printk(KERN_ERR "%s: Failure to create dentry in lower fs; " | 196 | printk(KERN_ERR "%s: Failure to create dentry in lower fs; " |
| 219 | "rc = [%d]\n", __func__, rc); | 197 | "rc = [%d]\n", __func__, rc); |
| @@ -294,7 +272,7 @@ ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry, | |||
| 294 | int rc; | 272 | int rc; |
| 295 | 273 | ||
| 296 | /* ecryptfs_do_create() calls ecryptfs_interpose() */ | 274 | /* ecryptfs_do_create() calls ecryptfs_interpose() */ |
| 297 | rc = ecryptfs_do_create(directory_inode, ecryptfs_dentry, mode, nd); | 275 | rc = ecryptfs_do_create(directory_inode, ecryptfs_dentry, mode); |
| 298 | if (unlikely(rc)) { | 276 | if (unlikely(rc)) { |
| 299 | ecryptfs_printk(KERN_WARNING, "Failed to create file in" | 277 | ecryptfs_printk(KERN_WARNING, "Failed to create file in" |
| 300 | "lower filesystem\n"); | 278 | "lower filesystem\n"); |
| @@ -942,10 +920,8 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) | |||
| 942 | } | 920 | } |
| 943 | 921 | ||
| 944 | static int | 922 | static int |
| 945 | ecryptfs_permission(struct inode *inode, int mask, unsigned int flags) | 923 | ecryptfs_permission(struct inode *inode, int mask) |
| 946 | { | 924 | { |
| 947 | if (flags & IPERM_FLAG_RCU) | ||
| 948 | return -ECHILD; | ||
| 949 | return inode_permission(ecryptfs_inode_to_lower(inode), mask); | 925 | return inode_permission(ecryptfs_inode_to_lower(inode), mask); |
| 950 | } | 926 | } |
| 951 | 927 | ||
