summary refs log tree commit diff
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-05-12 17:35:52 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-05-15 01:10:42 -0400
commit102b8af266fbce07b7f8d2396bf2286ba80c93bd (patch)
tree8817e48258adfb6c8ae4005eaf5ffc6a703f3e70 /fs/namei.c
parent5c31b6cedb675199bfd18c08a1223c9b39daedd7 (diff)
downloadlinux-102b8af266fbce07b7f8d2396bf2286ba80c93bd.tar.gz
namei: fold path_cleanup() into terminate_walk()
they are always called next to each other; moreover,
terminate_walk() is more symmetrical that way.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 484b73cb95e3..14aaf00f8ee7 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -584,6 +584,10 @@ static void terminate_walk(struct nameidata *nd)
 		path_put(&nd->path);
 		for (i = 0; i < nd->depth; i++)
 			path_put(&nd->stack[i].link);
+		if (nd->root.mnt && !(nd->flags & LOOKUP_ROOT)) {
+			path_put(&nd->root);
+			nd->root.mnt = NULL;
+		}
 	} else {
 		nd->flags &= ~LOOKUP_RCU;
 		if (!(nd->flags & LOOKUP_ROOT))
@@ -2051,14 +2055,6 @@ static const char *path_init(int dfd, const struct filename *name,
 	return ERR_PTR(-ECHILD);
 }
 
-static void path_cleanup(struct nameidata *nd)
-{
-	if (nd->root.mnt && !(nd->flags & LOOKUP_ROOT)) {
-		path_put(&nd->root);
-		nd->root.mnt = NULL;
-	}
-}
-
 static const char *trailing_symlink(struct nameidata *nd)
 {
 	const char *s;
@@ -2114,7 +2110,6 @@ static int path_lookupat(int dfd, const struct filename *name, unsigned flags,
 		nd->path.dentry = NULL;
 	}
 	terminate_walk(nd);
-	path_cleanup(nd);
 	return err;
 }
 
@@ -2162,7 +2157,6 @@ static int path_parentat(int dfd, const struct filename *name,
 		nd->path.dentry = NULL;
 	}
 	terminate_walk(nd);
-	path_cleanup(nd);
 	return err;
 }
 
@@ -2446,7 +2440,6 @@ path_mountpoint(int dfd, const struct filename *name, struct path *path,
 		}
 	}
 	terminate_walk(nd);
-	path_cleanup(nd);
 	return err;
 }
 
@@ -3318,7 +3311,6 @@ static struct file *path_openat(int dfd, struct filename *pathname,
 		}
 	}
 	terminate_walk(nd);
-	path_cleanup(nd);
 out2:
 	if (!(opened & FILE_OPENED)) {
 		BUG_ON(!error);