aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@www.linux.org.uk>2005-06-06 16:35:59 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-06 17:42:24 -0400
commit5f92b3bcec0fa2e2d775b589850097f9dc6b2de2 (patch)
tree239ce9af16392b452f651780e85b40b809b8d17a /fs/namei.c
parent90ebe5654febe3555a2516d51d3d251226d35fdb (diff)
[PATCH] namei fixes (2/19)
All callers of do_follow_link() do mntget() right before it and dput()+mntput() right after. These calls are moved inside do_follow_link() now. Obviously equivalent transformation. Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/namei.c b/fs/namei.c
index abeec34e7553..12d75ed214f6 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -526,6 +526,7 @@ static inline int __do_follow_link(struct dentry *dentry, struct nameidata *nd)
526static inline int do_follow_link(struct path *path, struct nameidata *nd) 526static inline int do_follow_link(struct path *path, struct nameidata *nd)
527{ 527{
528 int err = -ELOOP; 528 int err = -ELOOP;
529 mntget(path->mnt);
529 if (current->link_count >= MAX_NESTED_LINKS) 530 if (current->link_count >= MAX_NESTED_LINKS)
530 goto loop; 531 goto loop;
531 if (current->total_link_count >= 40) 532 if (current->total_link_count >= 40)
@@ -541,9 +542,13 @@ static inline int do_follow_link(struct path *path, struct nameidata *nd)
541 err = __do_follow_link(path->dentry, nd); 542 err = __do_follow_link(path->dentry, nd);
542 current->link_count--; 543 current->link_count--;
543 nd->depth--; 544 nd->depth--;
545 dput(path->dentry);
546 mntput(path->mnt);
544 return err; 547 return err;
545loop: 548loop:
546 path_release(nd); 549 path_release(nd);
550 dput(path->dentry);
551 mntput(path->mnt);
547 return err; 552 return err;
548} 553}
549 554
@@ -783,10 +788,7 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
783 goto out_dput; 788 goto out_dput;
784 789
785 if (inode->i_op->follow_link) { 790 if (inode->i_op->follow_link) {
786 mntget(next.mnt);
787 err = do_follow_link(&next, nd); 791 err = do_follow_link(&next, nd);
788 dput(next.dentry);
789 mntput(next.mnt);
790 if (err) 792 if (err)
791 goto return_err; 793 goto return_err;
792 err = -ENOENT; 794 err = -ENOENT;
@@ -837,10 +839,7 @@ last_component:
837 inode = next.dentry->d_inode; 839 inode = next.dentry->d_inode;
838 if ((lookup_flags & LOOKUP_FOLLOW) 840 if ((lookup_flags & LOOKUP_FOLLOW)
839 && inode && inode->i_op && inode->i_op->follow_link) { 841 && inode && inode->i_op && inode->i_op->follow_link) {
840 mntget(next.mnt);
841 err = do_follow_link(&next, nd); 842 err = do_follow_link(&next, nd);
842 dput(next.dentry);
843 mntput(next.mnt);
844 if (err) 843 if (err)
845 goto return_err; 844 goto return_err;
846 inode = nd->dentry->d_inode; 845 inode = nd->dentry->d_inode;