aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-06-26 13:58:53 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-07-22 16:01:29 -0400
commit765927b2d508712d320c8934db963bbe14c3fcec (patch)
tree97acdb14fae285764def396c4ed01d4d5c93e76a /fs/ecryptfs
parentbf349a447059656ebe63fb4fd1ccb27ac1da22ad (diff)
switch dentry_open() to struct path, make it grab references itself
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ecryptfs')
-rw-r--r--fs/ecryptfs/kthread.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c
index c7d199dc7d24..809e67d05ca3 100644
--- a/fs/ecryptfs/kthread.c
+++ b/fs/ecryptfs/kthread.c
@@ -29,8 +29,7 @@
29 29
30struct ecryptfs_open_req { 30struct ecryptfs_open_req {
31 struct file **lower_file; 31 struct file **lower_file;
32 struct dentry *lower_dentry; 32 struct path path;
33 struct vfsmount *lower_mnt;
34 struct completion done; 33 struct completion done;
35 struct list_head kthread_ctl_list; 34 struct list_head kthread_ctl_list;
36}; 35};
@@ -74,10 +73,7 @@ static int ecryptfs_threadfn(void *ignored)
74 struct ecryptfs_open_req, 73 struct ecryptfs_open_req,
75 kthread_ctl_list); 74 kthread_ctl_list);
76 list_del(&req->kthread_ctl_list); 75 list_del(&req->kthread_ctl_list);
77 dget(req->lower_dentry); 76 *req->lower_file = dentry_open(&req->path,
78 mntget(req->lower_mnt);
79 (*req->lower_file) = dentry_open(
80 req->lower_dentry, req->lower_mnt,
81 (O_RDWR | O_LARGEFILE), current_cred()); 77 (O_RDWR | O_LARGEFILE), current_cred());
82 complete(&req->done); 78 complete(&req->done);
83 } 79 }
@@ -140,23 +136,22 @@ int ecryptfs_privileged_open(struct file **lower_file,
140 int flags = O_LARGEFILE; 136 int flags = O_LARGEFILE;
141 int rc = 0; 137 int rc = 0;
142 138
139 init_completion(&req.done);
140 req.lower_file = lower_file;
141 req.path.dentry = lower_dentry;
142 req.path.mnt = lower_mnt;
143
143 /* Corresponding dput() and mntput() are done when the 144 /* Corresponding dput() and mntput() are done when the
144 * lower file is fput() when all eCryptfs files for the inode are 145 * lower file is fput() when all eCryptfs files for the inode are
145 * released. */ 146 * released. */
146 dget(lower_dentry);
147 mntget(lower_mnt);
148 flags |= IS_RDONLY(lower_dentry->d_inode) ? O_RDONLY : O_RDWR; 147 flags |= IS_RDONLY(lower_dentry->d_inode) ? O_RDONLY : O_RDWR;
149 (*lower_file) = dentry_open(lower_dentry, lower_mnt, flags, cred); 148 (*lower_file) = dentry_open(&req.path, flags, cred);
150 if (!IS_ERR(*lower_file)) 149 if (!IS_ERR(*lower_file))
151 goto out; 150 goto out;
152 if ((flags & O_ACCMODE) == O_RDONLY) { 151 if ((flags & O_ACCMODE) == O_RDONLY) {
153 rc = PTR_ERR((*lower_file)); 152 rc = PTR_ERR((*lower_file));
154 goto out; 153 goto out;
155 } 154 }
156 init_completion(&req.done);
157 req.lower_file = lower_file;
158 req.lower_dentry = lower_dentry;
159 req.lower_mnt = lower_mnt;
160 mutex_lock(&ecryptfs_kthread_ctl.mux); 155 mutex_lock(&ecryptfs_kthread_ctl.mux);
161 if (ecryptfs_kthread_ctl.flags & ECRYPTFS_KTHREAD_ZOMBIE) { 156 if (ecryptfs_kthread_ctl.flags & ECRYPTFS_KTHREAD_ZOMBIE) {
162 rc = -EIO; 157 rc = -EIO;