mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-07 22:42:04 +00:00
expand path_parent_directory() in its callers
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
63b27720a4
commit
a6a7eb7628
29
fs/namei.c
29
fs/namei.c
@ -1440,18 +1440,6 @@ static void follow_mount(struct path *path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
static int follow_dotdot(struct nameidata *nd)
|
||||||
{
|
{
|
||||||
struct dentry *parent;
|
struct dentry *parent;
|
||||||
@ -1462,9 +1450,13 @@ static int follow_dotdot(struct nameidata *nd)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (nd->path.dentry != nd->path.mnt->mnt_root) {
|
if (nd->path.dentry != nd->path.mnt->mnt_root) {
|
||||||
parent = path_parent_directory(&nd->path);
|
/* rare case of legitimate dget_parent()... */
|
||||||
if (!parent)
|
parent = dget_parent(nd->path.dentry);
|
||||||
|
|
||||||
|
if (unlikely(!path_connected(nd->path.mnt, parent))) {
|
||||||
|
dput(parent);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
}
|
||||||
dput(nd->path.dentry);
|
dput(nd->path.dentry);
|
||||||
nd->path.dentry = parent;
|
nd->path.dentry = parent;
|
||||||
break;
|
break;
|
||||||
@ -2602,13 +2594,14 @@ int path_pts(struct path *path)
|
|||||||
/* Find something mounted on "pts" in the same directory as
|
/* Find something mounted on "pts" in the same directory as
|
||||||
* the input path.
|
* the input path.
|
||||||
*/
|
*/
|
||||||
struct dentry *child, *parent;
|
struct dentry *parent = dget_parent(path->dentry);
|
||||||
|
struct dentry *child;
|
||||||
struct qstr this;
|
struct qstr this;
|
||||||
|
|
||||||
parent = path_parent_directory(path);
|
if (unlikely(!path_connected(path->mnt, parent))) {
|
||||||
if (!parent)
|
dput(parent);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
}
|
||||||
dput(path->dentry);
|
dput(path->dentry);
|
||||||
path->dentry = parent;
|
path->dentry = parent;
|
||||||
this.name = "pts";
|
this.name = "pts";
|
||||||
|
Loading…
Reference in New Issue
Block a user