summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-01-22 02:49:00 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2015-01-23 00:22:21 -0500
commitcbaab2db9103cc6727c7166d2fda9f64038c828c (patch)
tree380b2158c40f5df9ed2330d801a2a70f695ec5eb /fs
parent5168910413830435fa3f0a593933a83721ec8bad (diff)
downloadlinux-cbaab2db9103cc6727c7166d2fda9f64038c828c.tar.gz
linux-cbaab2db9103cc6727c7166d2fda9f64038c828c.tar.bz2
linux-cbaab2db9103cc6727c7166d2fda9f64038c828c.zip
simpler calling conventions for filename_mountpoint()
a) make it accept ERR_PTR() as filename (and return its PTR_ERR() in that case) b) make it putname() the sucker in the end otherwise simplifies life for callers... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/namei.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 0bc7742a591d..5ec3515162e6 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2373,13 +2373,17 @@ static int
filename_mountpoint(int dfd, struct filename *s, struct path *path,
unsigned int flags)
{
- int error = path_mountpoint(dfd, s->name, path, flags | LOOKUP_RCU);
+ int error;
+ if (IS_ERR(s))
+ return PTR_ERR(s);
+ error = path_mountpoint(dfd, s->name, path, flags | LOOKUP_RCU);
if (unlikely(error == -ECHILD))
error = path_mountpoint(dfd, s->name, path, flags);
if (unlikely(error == -ESTALE))
error = path_mountpoint(dfd, s->name, path, flags | LOOKUP_REVAL);
if (likely(!error))
audit_inode(s, path->dentry, 0);
+ putname(s);
return error;
}
@@ -2401,27 +2405,14 @@ int
user_path_mountpoint_at(int dfd, const char __user *name, unsigned int flags,
struct path *path)
{
- struct filename *s = getname(name);
- int error;
- if (IS_ERR(s))
- return PTR_ERR(s);
- error = filename_mountpoint(dfd, s, path, flags);
- putname(s);
- return error;
+ return filename_mountpoint(dfd, getname(name), path, flags);
}
int
kern_path_mountpoint(int dfd, const char *name, struct path *path,
unsigned int flags)
{
- struct filename *s = getname_kernel(name);
- int retval = PTR_ERR(s);
-
- if (!IS_ERR(s)) {
- retval = filename_mountpoint(dfd, s, path, flags);
- putname(s);
- }
- return retval;
+ return filename_mountpoint(dfd, getname_kernel(name), path, flags);
}
EXPORT_SYMBOL(kern_path_mountpoint);