aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-05-02 20:19:23 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-05-10 22:20:00 -0400
commitb9ff44293c64bf377e344c4cdc05d774b393cc6f (patch)
treef17f7f076a1eb3dea29c025647f1f49e45ab241f /fs/namei.c
parent1d8e03d359fd07edc884ffc45d42d60be9d9f098 (diff)
namei: trim redundant arguments of fs/namei.c:put_link()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 8c4f2af3a71a..1ac32178bd45 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -718,12 +718,13 @@ void nd_jump_link(struct nameidata *nd, struct path *path)
718 nd->flags |= LOOKUP_JUMPED; 718 nd->flags |= LOOKUP_JUMPED;
719} 719}
720 720
721static inline void put_link(struct nameidata *nd, struct path *link, void *cookie) 721static inline void put_link(struct nameidata *nd)
722{ 722{
723 struct inode *inode = link->dentry->d_inode; 723 struct saved *last = nd->stack + nd->depth;
724 if (cookie && inode->i_op->put_link) 724 struct inode *inode = last->link.dentry->d_inode;
725 inode->i_op->put_link(link->dentry, cookie); 725 if (last->cookie && inode->i_op->put_link)
726 path_put(link); 726 inode->i_op->put_link(last->link.dentry, last->cookie);
727 path_put(&last->link);
727} 728}
728 729
729int sysctl_protected_symlinks __read_mostly = 0; 730int sysctl_protected_symlinks __read_mostly = 0;
@@ -1809,7 +1810,7 @@ Walked:
1809 err = 0; 1810 err = 0;
1810 if (unlikely(!s)) { 1811 if (unlikely(!s)) {
1811 /* jumped */ 1812 /* jumped */
1812 put_link(nd, &last->link, last->cookie); 1813 put_link(nd);
1813 current->link_count--; 1814 current->link_count--;
1814 nd->depth--; 1815 nd->depth--;
1815 last--; 1816 last--;
@@ -1840,7 +1841,7 @@ Walked:
1840 terminate_walk(nd); 1841 terminate_walk(nd);
1841Err: 1842Err:
1842 while (unlikely(nd->depth)) { 1843 while (unlikely(nd->depth)) {
1843 put_link(nd, &last->link, last->cookie); 1844 put_link(nd);
1844 current->link_count--; 1845 current->link_count--;
1845 nd->depth--; 1846 nd->depth--;
1846 last--; 1847 last--;
@@ -1850,7 +1851,7 @@ OK:
1850 if (unlikely(nd->depth)) { 1851 if (unlikely(nd->depth)) {
1851 name = last->name; 1852 name = last->name;
1852 err = walk_component(nd, LOOKUP_FOLLOW); 1853 err = walk_component(nd, LOOKUP_FOLLOW);
1853 put_link(nd, &last->link, last->cookie); 1854 put_link(nd);
1854 current->link_count--; 1855 current->link_count--;
1855 nd->depth--; 1856 nd->depth--;
1856 last--; 1857 last--;
@@ -1995,7 +1996,7 @@ static int trailing_symlink(struct nameidata *nd)
1995 nd->inode = nd->path.dentry->d_inode; 1996 nd->inode = nd->path.dentry->d_inode;
1996 error = link_path_walk(s, nd); 1997 error = link_path_walk(s, nd);
1997 if (unlikely(error)) 1998 if (unlikely(error))
1998 put_link(nd, &nd->stack[0].link, nd->stack[0].cookie); 1999 put_link(nd);
1999 return error; 2000 return error;
2000} 2001}
2001 2002
@@ -2036,7 +2037,7 @@ static int path_lookupat(int dfd, const struct filename *name,
2036 if (err) 2037 if (err)
2037 break; 2038 break;
2038 err = lookup_last(nd); 2039 err = lookup_last(nd);
2039 put_link(nd, &nd->stack[0].link, nd->stack[0].cookie); 2040 put_link(nd);
2040 } 2041 }
2041 } 2042 }
2042 2043
@@ -2380,7 +2381,7 @@ path_mountpoint(int dfd, const struct filename *name, struct path *path,
2380 if (err) 2381 if (err)
2381 break; 2382 break;
2382 err = mountpoint_last(nd, path); 2383 err = mountpoint_last(nd, path);
2383 put_link(nd, &nd->stack[0].link, nd->stack[0].cookie); 2384 put_link(nd);
2384 } 2385 }
2385out: 2386out:
2386 path_cleanup(nd); 2387 path_cleanup(nd);
@@ -3262,7 +3263,7 @@ static struct file *path_openat(int dfd, struct filename *pathname,
3262 if (unlikely(error)) 3263 if (unlikely(error))
3263 break; 3264 break;
3264 error = do_last(nd, file, op, &opened, pathname); 3265 error = do_last(nd, file, op, &opened, pathname);
3265 put_link(nd, &nd->stack[0].link, nd->stack[0].cookie); 3266 put_link(nd);
3266 } 3267 }
3267out: 3268out:
3268 path_cleanup(nd); 3269 path_cleanup(nd);