}
}
-static struct dentry *path_parent_directory(struct path *path)
-{
- /* rare case of legitimate dget_parent()... */
- struct dentry *parent = dget_parent(path->dentry);
-
- if (unlikely(!path_connected(path->mnt, parent))) {
- dput(parent);
- parent = NULL;
- }
- return parent;
-}
-
static int follow_dotdot(struct nameidata *nd)
{
struct dentry *parent;
break;
}
if (nd->path.dentry != nd->path.mnt->mnt_root) {
- parent = path_parent_directory(&nd->path);
- if (!parent)
+ /* rare case of legitimate dget_parent()... */
+ parent = dget_parent(nd->path.dentry);
+
+ if (unlikely(!path_connected(nd->path.mnt, parent))) {
+ dput(parent);
return -ENOENT;
+ }
dput(nd->path.dentry);
nd->path.dentry = parent;
break;
/* Find something mounted on "pts" in the same directory as
* the input path.
*/
- struct dentry *child, *parent;
+ struct dentry *parent = dget_parent(path->dentry);
+ struct dentry *child;
struct qstr this;
- parent = path_parent_directory(path);
- if (!parent)
+ if (unlikely(!path_connected(path->mnt, parent))) {
+ dput(parent);
return -ENOENT;
-
+ }
dput(path->dentry);
path->dentry = parent;
this.name = "pts";