summaryrefslogtreecommitdiff
path: root/fs/nsfs.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2016-09-22 19:39:20 -0500
committerEric W. Biederman <ebiederm@xmission.com>2016-09-22 20:06:20 -0500
commit213b067ce314f9d7e72307c7036ba3cd285b80da (patch)
treef3922b5859e6c09f064702e9fc4c40f79911e497 /fs/nsfs.c
parent78725596644be0181c46f55c52aadfb8c70bcdb7 (diff)
nsfs: Simplify __ns_get_path
Move mntget from the very beginning of __ns_get_path to the success path of __ns_get_path, and remove the mntget calls. This removes the possibility that there will be a mntget/mntput pair of __ns_get_path has to retry, and generally simplifies the code. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'fs/nsfs.c')
-rw-r--r--fs/nsfs.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/fs/nsfs.c b/fs/nsfs.c
index fb7b397a1297..30bb10034120 100644
--- a/fs/nsfs.c
+++ b/fs/nsfs.c
@@ -51,7 +51,7 @@ static void nsfs_evict(struct inode *inode)
static void *__ns_get_path(struct path *path, struct ns_common *ns)
{
- struct vfsmount *mnt = mntget(nsfs_mnt);
+ struct vfsmount *mnt = nsfs_mnt;
struct qstr qname = { .name = "", };
struct dentry *dentry;
struct inode *inode;
@@ -67,7 +67,7 @@ static void *__ns_get_path(struct path *path, struct ns_common *ns)
rcu_read_unlock();
ns->ops->put(ns);
got_it:
- path->mnt = mnt;
+ path->mnt = mntget(mnt);
path->dentry = dentry;
return NULL;
slow:
@@ -75,7 +75,6 @@ slow:
inode = new_inode_pseudo(mnt->mnt_sb);
if (!inode) {
ns->ops->put(ns);
- mntput(mnt);
return ERR_PTR(-ENOMEM);
}
inode->i_ino = ns->inum;
@@ -88,7 +87,6 @@ slow:
dentry = d_alloc_pseudo(mnt->mnt_sb, &qname);
if (!dentry) {
iput(inode);
- mntput(mnt);
return ERR_PTR(-ENOMEM);
}
d_instantiate(dentry, inode);
@@ -97,7 +95,6 @@ slow:
if (d) {
d_delete(dentry); /* make sure ->d_prune() does nothing */
dput(dentry);
- mntput(mnt);
cpu_relax();
return ERR_PTR(-EAGAIN);
}