Make vfs_path_lookup() use starting point as root
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 7 Apr 2009 15:53:49 +0000 (11:53 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 12 Jun 2009 01:35:59 +0000 (21:35 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namei.c

index 88baaf2b91677889f6a365bf54d7ba042ea5e4c4..4379ef9897092303467c9a8763d76ebafd27e56f 100644 (file)
@@ -1123,21 +1123,20 @@ int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt,
        nd->last_type = LAST_ROOT;
        nd->flags = flags;
        nd->depth = 0;
-       nd->root.mnt = NULL;
 
        nd->path.dentry = dentry;
        nd->path.mnt = mnt;
        path_get(&nd->path);
+       nd->root = nd->path;
+       path_get(&nd->root);
 
        retval = path_walk(name, nd);
        if (unlikely(!retval && !audit_dummy_context() && nd->path.dentry &&
                                nd->path.dentry->d_inode))
                audit_inode(name, nd->path.dentry);
 
-       if (nd->root.mnt) {
-               path_put(&nd->root);
-               nd->root.mnt = NULL;
-       }
+       path_put(&nd->root);
+       nd->root.mnt = NULL;
 
        return retval;
 }