Skip to content

Commit

Permalink
[PATCH] namei fixes (8/19)
Browse files Browse the repository at this point in the history
In open_namei() we never use path.mnt or path.dentry after exit: or ok:.
Assignment of path.dentry in case of LAST_BIND is dead code and only
obfuscates already convoluted function; assignment of path.mnt after
__do_follow_link() can be moved down to the place where we set path.dentry.

Obviously equivalent transformations, just to clean the air a bit in that
region.

Signed-off-by: Al Viro <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Al Viro authored and Linus Torvalds committed Jun 6, 2005
1 parent cd4e91d commit d671d5e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -1526,14 +1526,11 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
if (error)
goto exit_dput;
error = __do_follow_link(&path, nd);
path.mnt = nd->mnt;
if (error)
return error;
nd->flags &= ~LOOKUP_PARENT;
if (nd->last_type == LAST_BIND) {
path.dentry = nd->dentry;
if (nd->last_type == LAST_BIND)
goto ok;
}
error = -EISDIR;
if (nd->last_type != LAST_NORM)
goto exit;
Expand All @@ -1549,6 +1546,7 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
dir = nd->dentry;
down(&dir->d_inode->i_sem);
path.dentry = __lookup_hash(&nd->last, nd->dentry, nd);
path.mnt = nd->mnt;
putname(nd->last.name);
goto do_last;
}
Expand Down

0 comments on commit d671d5e

Please sign in to comment.