Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 1848
b: refs/heads/master
c: 463ffb2
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro authored and Linus Torvalds committed Jun 6, 2005
1 parent 1ec104b commit 252f314
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 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: d671d5e51400aab03c713a16ce3545aa81ad7b1c
refs/heads/master: 463ffb2e9d39c2a3fd8c3c1d4a34e01f2078f972
25 changes: 23 additions & 2 deletions trunk/fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,23 @@ int follow_up(struct vfsmount **mnt, struct dentry **dentry)
/* no need for dcache_lock, as serialization is taken care in
* namespace.c
*/
static int __follow_mount(struct path *path)
{
int res = 0;
while (d_mountpoint(path->dentry)) {
struct vfsmount *mounted = lookup_mnt(path->mnt, path->dentry);
if (!mounted)
break;
dput(path->dentry);
if (res)
mntput(path->mnt);
path->mnt = mounted;
path->dentry = dget(mounted->mnt_root);
res = 1;
}
return res;
}

static int follow_mount(struct vfsmount **mnt, struct dentry **dentry)
{
int res = 0;
Expand Down Expand Up @@ -778,7 +795,9 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
if (err)
break;
/* Check mountpoints.. */
follow_mount(&next.mnt, &next.dentry);
__follow_mount(&next);
if (nd->mnt != next.mnt)
mntput(nd->mnt);

err = -ENOENT;
inode = next.dentry->d_inode;
Expand Down Expand Up @@ -836,7 +855,9 @@ static fastcall int __link_path_walk(const char * name, struct nameidata *nd)
err = do_lookup(nd, &this, &next);
if (err)
break;
follow_mount(&next.mnt, &next.dentry);
__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) {
Expand Down

0 comments on commit 252f314

Please sign in to comment.