Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 7432
b: refs/heads/master
c: 09dd17d
h: refs/heads/master
v: v3
  • Loading branch information
Miklos Szeredi authored and Linus Torvalds committed Sep 7, 2005
1 parent 5338d05 commit f2a9269
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e89bbd3a0b3c054d9a94feb0db7bbae1cdb99e54
refs/heads/master: 09dd17d3e5e43ea6d3f3a12829108c4ca13ff810
52 changes: 24 additions & 28 deletions trunk/fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,22 @@ static inline int __do_follow_link(struct path *path, struct nameidata *nd)
return error;
}

static inline void dput_path(struct path *path, struct nameidata *nd)
{
dput(path->dentry);
if (path->mnt != nd->mnt)
mntput(path->mnt);
}

static inline void path_to_nameidata(struct path *path, struct nameidata *nd)
{
dput(nd->dentry);
if (nd->mnt != path->mnt)
mntput(nd->mnt);
nd->mnt = path->mnt;
nd->dentry = path->dentry;
}

/*
* This limits recursive symlink follows to 8, while
* limiting consecutive symlinks to 40.
Expand Down Expand Up @@ -552,9 +568,7 @@ static inline int do_follow_link(struct path *path, struct nameidata *nd)
nd->depth--;
return err;
loop:
dput(path->dentry);
if (path->mnt != nd->mnt)
mntput(path->mnt);
dput_path(path, nd);
path_release(nd);
return err;
}
Expand Down Expand Up @@ -813,13 +827,8 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
err = -ENOTDIR;
if (!inode->i_op)
break;
} else {
dput(nd->dentry);
if (nd->mnt != next.mnt)
mntput(nd->mnt);
nd->mnt = next.mnt;
nd->dentry = next.dentry;
}
} else
path_to_nameidata(&next, nd);
err = -ENOTDIR;
if (!inode->i_op->lookup)
break;
Expand Down Expand Up @@ -859,13 +868,8 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *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;
}
} else
path_to_nameidata(&next, nd);
err = -ENOENT;
if (!inode)
break;
Expand Down Expand Up @@ -901,9 +905,7 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
return_base:
return 0;
out_dput:
dput(next.dentry);
if (nd->mnt != next.mnt)
mntput(next.mnt);
dput_path(&next, nd);
break;
}
path_release(nd);
Expand Down Expand Up @@ -1507,11 +1509,7 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
if (path.dentry->d_inode->i_op && path.dentry->d_inode->i_op->follow_link)
goto do_link;

dput(nd->dentry);
nd->dentry = path.dentry;
if (nd->mnt != path.mnt)
mntput(nd->mnt);
nd->mnt = path.mnt;
path_to_nameidata(&path, nd);
error = -EISDIR;
if (path.dentry->d_inode && S_ISDIR(path.dentry->d_inode->i_mode))
goto exit;
Expand All @@ -1522,9 +1520,7 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
return 0;

exit_dput:
dput(path.dentry);
if (nd->mnt != path.mnt)
mntput(path.mnt);
dput_path(&path, nd);
exit:
path_release(nd);
return error;
Expand Down

0 comments on commit f2a9269

Please sign in to comment.