aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
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/namei.c
parent5168910413830435fa3f0a593933a83721ec8bad (diff)
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/namei.c')
-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
2373filename_mountpoint(int dfd, struct filename *s, struct path *path, 2373filename_mountpoint(int dfd, struct filename *s, struct path *path,
2374 unsigned int flags) 2374 unsigned int flags)
2375{ 2375{
2376 int error = path_mountpoint(dfd, s->name, path, flags | LOOKUP_RCU); 2376 int error;
2377 if (IS_ERR(s))
2378 return PTR_ERR(s);
2379 error = path_mountpoint(dfd, s->name, path, flags | LOOKUP_RCU);
2377 if (unlikely(error == -ECHILD)) 2380 if (unlikely(error == -ECHILD))
2378 error = path_mountpoint(dfd, s->name, path, flags); 2381 error = path_mountpoint(dfd, s->name, path, flags);
2379 if (unlikely(error == -ESTALE)) 2382 if (unlikely(error == -ESTALE))
2380 error = path_mountpoint(dfd, s->name, path, flags | LOOKUP_REVAL); 2383 error = path_mountpoint(dfd, s->name, path, flags | LOOKUP_REVAL);
2381 if (likely(!error)) 2384 if (likely(!error))
2382 audit_inode(s, path->dentry, 0); 2385 audit_inode(s, path->dentry, 0);
2386 putname(s);
2383 return error; 2387 return error;
2384} 2388}
2385 2389
@@ -2401,27 +2405,14 @@ int
2401user_path_mountpoint_at(int dfd, const char __user *name, unsigned int flags, 2405user_path_mountpoint_at(int dfd, const char __user *name, unsigned int flags,
2402 struct path *path) 2406 struct path *path)
2403{ 2407{
2404 struct filename *s = getname(name); 2408 return filename_mountpoint(dfd, getname(name), path, flags);
2405 int error;
2406 if (IS_ERR(s))
2407 return PTR_ERR(s);
2408 error = filename_mountpoint(dfd, s, path, flags);
2409 putname(s);
2410 return error;
2411} 2409}
2412 2410
2413int 2411int
2414kern_path_mountpoint(int dfd, const char *name, struct path *path, 2412kern_path_mountpoint(int dfd, const char *name, struct path *path,
2415 unsigned int flags) 2413 unsigned int flags)
2416{ 2414{
2417 struct filename *s = getname_kernel(name); 2415 return filename_mountpoint(dfd, getname_kernel(name), path, flags);
2418 int retval = PTR_ERR(s);
2419
2420 if (!IS_ERR(s)) {
2421 retval = filename_mountpoint(dfd, s, path, flags);
2422 putname(s);
2423 }
2424 return retval;
2425} 2416}
2426EXPORT_SYMBOL(kern_path_mountpoint); 2417EXPORT_SYMBOL(kern_path_mountpoint);
2427 2418