switch dentry_open() to struct path, make it grab references itself

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro
2012-06-26 21:58:53 +04:00
parent bf349a4470
commit 765927b2d5
15 changed files with 106 additions and 151 deletions

View File

@@ -29,8 +29,7 @@
struct ecryptfs_open_req {
struct file **lower_file;
struct dentry *lower_dentry;
struct vfsmount *lower_mnt;
struct path path;
struct completion done;
struct list_head kthread_ctl_list;
};
@@ -74,10 +73,7 @@ static int ecryptfs_threadfn(void *ignored)
struct ecryptfs_open_req,
kthread_ctl_list);
list_del(&req->kthread_ctl_list);
dget(req->lower_dentry);
mntget(req->lower_mnt);
(*req->lower_file) = dentry_open(
req->lower_dentry, req->lower_mnt,
*req->lower_file = dentry_open(&req->path,
(O_RDWR | O_LARGEFILE), current_cred());
complete(&req->done);
}
@@ -140,23 +136,22 @@ int ecryptfs_privileged_open(struct file **lower_file,
int flags = O_LARGEFILE;
int rc = 0;
init_completion(&req.done);
req.lower_file = lower_file;
req.path.dentry = lower_dentry;
req.path.mnt = lower_mnt;
/* Corresponding dput() and mntput() are done when the
* lower file is fput() when all eCryptfs files for the inode are
* released. */
dget(lower_dentry);
mntget(lower_mnt);
flags |= IS_RDONLY(lower_dentry->d_inode) ? O_RDONLY : O_RDWR;
(*lower_file) = dentry_open(lower_dentry, lower_mnt, flags, cred);
(*lower_file) = dentry_open(&req.path, flags, cred);
if (!IS_ERR(*lower_file))
goto out;
if ((flags & O_ACCMODE) == O_RDONLY) {
rc = PTR_ERR((*lower_file));
goto out;
}
init_completion(&req.done);
req.lower_file = lower_file;
req.lower_dentry = lower_dentry;
req.lower_mnt = lower_mnt;
mutex_lock(&ecryptfs_kthread_ctl.mux);
if (ecryptfs_kthread_ctl.flags & ECRYPTFS_KTHREAD_ZOMBIE) {
rc = -EIO;