Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24254
b: refs/heads/master
c: 051d381
h: refs/heads/master
v: v3
  • Loading branch information
Ian Kent authored and Linus Torvalds committed Mar 27, 2006
1 parent 9b967f2 commit b91f675
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 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: f75ba3ade8a4599d67040a9493d75a864e7b329c
refs/heads/master: 051d381259eb57d6074d02a6ba6e90e744f1a29f
39 changes: 21 additions & 18 deletions trunk/fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,22 @@ struct path {
struct dentry *dentry;
};

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;
}

static __always_inline int __do_follow_link(struct path *path, struct nameidata *nd)
{
int error;
Expand All @@ -555,8 +571,11 @@ static __always_inline int __do_follow_link(struct path *path, struct nameidata
touch_atime(path->mnt, dentry);
nd_set_link(nd, NULL);

if (path->mnt == nd->mnt)
mntget(path->mnt);
if (path->mnt != nd->mnt) {
path_to_nameidata(path, nd);
dget(dentry);
}
mntget(path->mnt);
cookie = dentry->d_inode->i_op->follow_link(dentry, nd);
error = PTR_ERR(cookie);
if (!IS_ERR(cookie)) {
Expand All @@ -573,22 +592,6 @@ static __always_inline int __do_follow_link(struct path *path, struct nameidata
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

0 comments on commit b91f675

Please sign in to comment.