Skip to content

Commit

Permalink
[PATCH] namei fixes (11/19)
Browse files Browse the repository at this point in the history
shifted conditional mntput() calls in __link_path_walk() downstream.

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>
  • Loading branch information
Al Viro authored and Linus Torvalds committed Jun 6, 2005
1 parent e13b210 commit 2f12dbf
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -791,8 +791,6 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
break;
/* Check mountpoints.. */
__follow_mount(&next);
if (nd->mnt != next.mnt)
mntput(nd->mnt);

err = -ENOENT;
inode = next.dentry->d_inode;
Expand All @@ -803,6 +801,8 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
goto out_dput;

if (inode->i_op->follow_link) {
if (nd->mnt != next.mnt)
mntput(nd->mnt);
err = do_follow_link(&next, nd);
if (err)
goto return_err;
Expand All @@ -815,6 +815,8 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
break;
} else {
dput(nd->dentry);
if (nd->mnt != next.mnt)
mntput(nd->mnt);
nd->mnt = next.mnt;
nd->dentry = next.dentry;
}
Expand Down Expand Up @@ -851,17 +853,19 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
if (err)
break;
__follow_mount(&next);
if (nd->mnt != next.mnt)
mntput(nd->mnt);
inode = next.dentry->d_inode;
if ((lookup_flags & LOOKUP_FOLLOW)
&& inode && inode->i_op && inode->i_op->follow_link) {
if (next.mnt != nd->mnt)
mntput(nd->mnt);
err = do_follow_link(&next, nd);
if (err)
goto return_err;
inode = nd->dentry->d_inode;
} else {
dput(nd->dentry);
if (nd->mnt != next.mnt)
mntput(nd->mnt);
nd->mnt = next.mnt;
nd->dentry = next.dentry;
}
Expand Down Expand Up @@ -901,6 +905,8 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
return 0;
out_dput:
dput(next.dentry);
if (nd->mnt != next.mnt)
mntput(nd->mnt);
break;
}
path_release(nd);
Expand Down

0 comments on commit 2f12dbf

Please sign in to comment.