Clean follow_dotdot() up a bit
No need to open-code follow_up() in it and locking can be lighter. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
de27a5bf9c
commit
3088dd7080
1 changed files with 3 additions and 16 deletions
19
fs/namei.c
19
fs/namei.c
|
@ -689,34 +689,21 @@ static __always_inline void follow_dotdot(struct nameidata *nd)
|
||||||
set_root(nd);
|
set_root(nd);
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
struct vfsmount *parent;
|
|
||||||
struct dentry *old = nd->path.dentry;
|
struct dentry *old = nd->path.dentry;
|
||||||
|
|
||||||
if (nd->path.dentry == nd->root.dentry &&
|
if (nd->path.dentry == nd->root.dentry &&
|
||||||
nd->path.mnt == nd->root.mnt) {
|
nd->path.mnt == nd->root.mnt) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
spin_lock(&dcache_lock);
|
|
||||||
if (nd->path.dentry != nd->path.mnt->mnt_root) {
|
if (nd->path.dentry != nd->path.mnt->mnt_root) {
|
||||||
nd->path.dentry = dget(nd->path.dentry->d_parent);
|
/* rare case of legitimate dget_parent()... */
|
||||||
spin_unlock(&dcache_lock);
|
nd->path.dentry = dget_parent(nd->path.dentry);
|
||||||
dput(old);
|
dput(old);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
spin_unlock(&dcache_lock);
|
if (!follow_up(&nd->path))
|
||||||
spin_lock(&vfsmount_lock);
|
|
||||||
parent = nd->path.mnt->mnt_parent;
|
|
||||||
if (parent == nd->path.mnt) {
|
|
||||||
spin_unlock(&vfsmount_lock);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mntget(parent);
|
|
||||||
nd->path.dentry = dget(nd->path.mnt->mnt_mountpoint);
|
|
||||||
spin_unlock(&vfsmount_lock);
|
|
||||||
dput(old);
|
|
||||||
mntput(nd->path.mnt);
|
|
||||||
nd->path.mnt = parent;
|
|
||||||
}
|
|
||||||
follow_mount(&nd->path);
|
follow_mount(&nd->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue