diff options
Diffstat (limited to 'fs/ecryptfs')
-rw-r--r-- | fs/ecryptfs/file.c | 7 | ||||
-rw-r--r-- | fs/ecryptfs/inode.c | 37 |
2 files changed, 10 insertions, 34 deletions
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index 4ec9eb00a241..c6ac98cf9baa 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
@@ -270,14 +270,15 @@ static int ecryptfs_release(struct inode *inode, struct file *file) | |||
270 | } | 270 | } |
271 | 271 | ||
272 | static int | 272 | static int |
273 | ecryptfs_fsync(struct file *file, int datasync) | 273 | ecryptfs_fsync(struct file *file, loff_t start, loff_t end, int datasync) |
274 | { | 274 | { |
275 | int rc = 0; | 275 | int rc = 0; |
276 | 276 | ||
277 | rc = generic_file_fsync(file, datasync); | 277 | rc = generic_file_fsync(file, start, end, datasync); |
278 | if (rc) | 278 | if (rc) |
279 | goto out; | 279 | goto out; |
280 | rc = vfs_fsync(ecryptfs_file_to_lower(file), datasync); | 280 | rc = vfs_fsync_range(ecryptfs_file_to_lower(file), start, end, |
281 | datasync); | ||
281 | out: | 282 | out: |
282 | return rc; | 283 | return rc; |
283 | } | 284 | } |
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 7349ade17de6..340c657a108c 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -147,7 +147,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 | 147 | * @lower_dir_inode: inode of the parent in the lower fs of the new file |
148 | * @dentry: New file's dentry | 148 | * @dentry: New file's dentry |
149 | * @mode: The mode of the new file | 149 | * @mode: The mode of the new file |
150 | * @nd: nameidata of ecryptfs' parent's dentry & vfsmount | ||
151 | * | 150 | * |
152 | * Creates the file in the lower file system. | 151 | * Creates the file in the lower file system. |
153 | * | 152 | * |
@@ -155,31 +154,10 @@ static int ecryptfs_interpose(struct dentry *lower_dentry, | |||
155 | */ | 154 | */ |
156 | static int | 155 | static int |
157 | ecryptfs_create_underlying_file(struct inode *lower_dir_inode, | 156 | ecryptfs_create_underlying_file(struct inode *lower_dir_inode, |
158 | struct dentry *dentry, int mode, | 157 | struct dentry *dentry, int mode) |
159 | struct nameidata *nd) | ||
160 | { | 158 | { |
161 | struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); | 159 | struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); |
162 | struct vfsmount *lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); | 160 | 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 | } | 161 | } |
184 | 162 | ||
185 | /** | 163 | /** |
@@ -197,8 +175,7 @@ ecryptfs_create_underlying_file(struct inode *lower_dir_inode, | |||
197 | */ | 175 | */ |
198 | static int | 176 | static int |
199 | ecryptfs_do_create(struct inode *directory_inode, | 177 | ecryptfs_do_create(struct inode *directory_inode, |
200 | struct dentry *ecryptfs_dentry, int mode, | 178 | struct dentry *ecryptfs_dentry, int mode) |
201 | struct nameidata *nd) | ||
202 | { | 179 | { |
203 | int rc; | 180 | int rc; |
204 | struct dentry *lower_dentry; | 181 | struct dentry *lower_dentry; |
@@ -213,7 +190,7 @@ ecryptfs_do_create(struct inode *directory_inode, | |||
213 | goto out; | 190 | goto out; |
214 | } | 191 | } |
215 | rc = ecryptfs_create_underlying_file(lower_dir_dentry->d_inode, | 192 | rc = ecryptfs_create_underlying_file(lower_dir_dentry->d_inode, |
216 | ecryptfs_dentry, mode, nd); | 193 | ecryptfs_dentry, mode); |
217 | if (rc) { | 194 | if (rc) { |
218 | printk(KERN_ERR "%s: Failure to create dentry in lower fs; " | 195 | printk(KERN_ERR "%s: Failure to create dentry in lower fs; " |
219 | "rc = [%d]\n", __func__, rc); | 196 | "rc = [%d]\n", __func__, rc); |
@@ -294,7 +271,7 @@ ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry, | |||
294 | int rc; | 271 | int rc; |
295 | 272 | ||
296 | /* ecryptfs_do_create() calls ecryptfs_interpose() */ | 273 | /* ecryptfs_do_create() calls ecryptfs_interpose() */ |
297 | rc = ecryptfs_do_create(directory_inode, ecryptfs_dentry, mode, nd); | 274 | rc = ecryptfs_do_create(directory_inode, ecryptfs_dentry, mode); |
298 | if (unlikely(rc)) { | 275 | if (unlikely(rc)) { |
299 | ecryptfs_printk(KERN_WARNING, "Failed to create file in" | 276 | ecryptfs_printk(KERN_WARNING, "Failed to create file in" |
300 | "lower filesystem\n"); | 277 | "lower filesystem\n"); |
@@ -942,10 +919,8 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) | |||
942 | } | 919 | } |
943 | 920 | ||
944 | static int | 921 | static int |
945 | ecryptfs_permission(struct inode *inode, int mask, unsigned int flags) | 922 | ecryptfs_permission(struct inode *inode, int mask) |
946 | { | 923 | { |
947 | if (flags & IPERM_FLAG_RCU) | ||
948 | return -ECHILD; | ||
949 | return inode_permission(ecryptfs_inode_to_lower(inode), mask); | 924 | return inode_permission(ecryptfs_inode_to_lower(inode), mask); |
950 | } | 925 | } |
951 | 926 | ||