aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/inode.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2015-02-10 14:35:36 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2015-02-10 14:35:36 -0500
commit4ba24fef3eb3b142197135223b90ced2f319cd53 (patch)
treea20c125b27740ec7b4c761b11d801108e1b316b2 /fs/ecryptfs/inode.c
parent47c1ffb2b6b630894e9a16442611c056ab21c057 (diff)
parent98a4a59ee31a12105a2b84f5b8b515ac2cb208ef (diff)
Merge branch 'next' into for-linus
Prepare first round of input updates for 3.20.
Diffstat (limited to 'fs/ecryptfs/inode.c')
-rw-r--r--fs/ecryptfs/inode.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index d4a9431ec73c..1686dc2da9fd 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -53,9 +53,7 @@ static void unlock_dir(struct dentry *dir)
53 53
54static int ecryptfs_inode_test(struct inode *inode, void *lower_inode) 54static int ecryptfs_inode_test(struct inode *inode, void *lower_inode)
55{ 55{
56 if (ecryptfs_inode_to_lower(inode) == (struct inode *)lower_inode) 56 return ecryptfs_inode_to_lower(inode) == lower_inode;
57 return 1;
58 return 0;
59} 57}
60 58
61static int ecryptfs_inode_set(struct inode *inode, void *opaque) 59static int ecryptfs_inode_set(struct inode *inode, void *opaque)
@@ -192,12 +190,6 @@ ecryptfs_do_create(struct inode *directory_inode,
192 190
193 lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry); 191 lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry);
194 lower_dir_dentry = lock_parent(lower_dentry); 192 lower_dir_dentry = lock_parent(lower_dentry);
195 if (IS_ERR(lower_dir_dentry)) {
196 ecryptfs_printk(KERN_ERR, "Error locking directory of "
197 "dentry\n");
198 inode = ERR_CAST(lower_dir_dentry);
199 goto out;
200 }
201 rc = vfs_create(lower_dir_dentry->d_inode, lower_dentry, mode, true); 193 rc = vfs_create(lower_dir_dentry->d_inode, lower_dentry, mode, true);
202 if (rc) { 194 if (rc) {
203 printk(KERN_ERR "%s: Failure to create dentry in lower fs; " 195 printk(KERN_ERR "%s: Failure to create dentry in lower fs; "
@@ -215,7 +207,6 @@ ecryptfs_do_create(struct inode *directory_inode,
215 fsstack_copy_inode_size(directory_inode, lower_dir_dentry->d_inode); 207 fsstack_copy_inode_size(directory_inode, lower_dir_dentry->d_inode);
216out_lock: 208out_lock:
217 unlock_dir(lower_dir_dentry); 209 unlock_dir(lower_dir_dentry);
218out:
219 return inode; 210 return inode;
220} 211}
221 212
@@ -250,8 +241,8 @@ int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry,
250 if (rc) { 241 if (rc) {
251 printk(KERN_ERR "%s: Error attempting to initialize " 242 printk(KERN_ERR "%s: Error attempting to initialize "
252 "the lower file for the dentry with name " 243 "the lower file for the dentry with name "
253 "[%s]; rc = [%d]\n", __func__, 244 "[%pd]; rc = [%d]\n", __func__,
254 ecryptfs_dentry->d_name.name, rc); 245 ecryptfs_dentry, rc);
255 goto out; 246 goto out;
256 } 247 }
257 rc = ecryptfs_write_metadata(ecryptfs_dentry, ecryptfs_inode); 248 rc = ecryptfs_write_metadata(ecryptfs_dentry, ecryptfs_inode);
@@ -313,8 +304,8 @@ static int ecryptfs_i_size_read(struct dentry *dentry, struct inode *inode)
313 if (rc) { 304 if (rc) {
314 printk(KERN_ERR "%s: Error attempting to initialize " 305 printk(KERN_ERR "%s: Error attempting to initialize "
315 "the lower file for the dentry with name " 306 "the lower file for the dentry with name "
316 "[%s]; rc = [%d]\n", __func__, 307 "[%pd]; rc = [%d]\n", __func__,
317 dentry->d_name.name, rc); 308 dentry, rc);
318 return rc; 309 return rc;
319 } 310 }
320 311
@@ -418,8 +409,8 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode,
418 if (IS_ERR(lower_dentry)) { 409 if (IS_ERR(lower_dentry)) {
419 rc = PTR_ERR(lower_dentry); 410 rc = PTR_ERR(lower_dentry);
420 ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned " 411 ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned "
421 "[%d] on lower_dentry = [%s]\n", __func__, rc, 412 "[%d] on lower_dentry = [%pd]\n", __func__, rc,
422 ecryptfs_dentry->d_name.name); 413 ecryptfs_dentry);
423 goto out; 414 goto out;
424 } 415 }
425 if (lower_dentry->d_inode) 416 if (lower_dentry->d_inode)
@@ -1039,7 +1030,7 @@ ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value,
1039 } 1030 }
1040 1031
1041 rc = vfs_setxattr(lower_dentry, name, value, size, flags); 1032 rc = vfs_setxattr(lower_dentry, name, value, size, flags);
1042 if (!rc) 1033 if (!rc && dentry->d_inode)
1043 fsstack_copy_attr_all(dentry->d_inode, lower_dentry->d_inode); 1034 fsstack_copy_attr_all(dentry->d_inode, lower_dentry->d_inode);
1044out: 1035out:
1045 return rc; 1036 return rc;