mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-08 15:04:45 +00:00
Pull handling of LAST_BIND into do_last(), clean up ok: part in do_filp_open()
Note that in case of !O_CREAT we know that nd.root has already been given up Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
4296e2cbf2
commit
67ee3ad21d
17
fs/namei.c
17
fs/namei.c
@ -1656,6 +1656,9 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
|
|||||||
|
|
||||||
*is_link = 0;
|
*is_link = 0;
|
||||||
|
|
||||||
|
if (nd->last_type == LAST_BIND)
|
||||||
|
goto ok;
|
||||||
|
|
||||||
error = -EISDIR;
|
error = -EISDIR;
|
||||||
if (nd->last_type != LAST_NORM || nd->last.name[nd->last.len])
|
if (nd->last_type != LAST_NORM || nd->last.name[nd->last.len])
|
||||||
goto exit;
|
goto exit;
|
||||||
@ -1733,6 +1736,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
|
|||||||
error = -EISDIR;
|
error = -EISDIR;
|
||||||
if (S_ISDIR(path->dentry->d_inode->i_mode))
|
if (S_ISDIR(path->dentry->d_inode->i_mode))
|
||||||
goto exit;
|
goto exit;
|
||||||
|
ok:
|
||||||
filp = finish_open(nd, open_flag, acc_mode);
|
filp = finish_open(nd, open_flag, acc_mode);
|
||||||
return filp;
|
return filp;
|
||||||
|
|
||||||
@ -1808,7 +1812,7 @@ struct file *do_filp_open(int dfd, const char *pathname,
|
|||||||
release_open_intent(&nd);
|
release_open_intent(&nd);
|
||||||
if (error)
|
if (error)
|
||||||
return ERR_PTR(error);
|
return ERR_PTR(error);
|
||||||
goto ok;
|
return finish_open(&nd, open_flag, acc_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1853,21 +1857,14 @@ struct file *do_filp_open(int dfd, const char *pathname,
|
|||||||
path_put(&nd.root);
|
path_put(&nd.root);
|
||||||
return filp;
|
return filp;
|
||||||
|
|
||||||
ok:
|
|
||||||
filp = finish_open(&nd, open_flag, acc_mode);
|
|
||||||
if (nd.root.mnt)
|
|
||||||
path_put(&nd.root);
|
|
||||||
return filp;
|
|
||||||
|
|
||||||
exit_dput:
|
exit_dput:
|
||||||
path_put_conditional(&path, &nd);
|
path_put_conditional(&path, &nd);
|
||||||
exit:
|
|
||||||
if (!IS_ERR(nd.intent.open.file))
|
if (!IS_ERR(nd.intent.open.file))
|
||||||
release_open_intent(&nd);
|
release_open_intent(&nd);
|
||||||
exit_parent:
|
exit_parent:
|
||||||
|
path_put(&nd.path);
|
||||||
if (nd.root.mnt)
|
if (nd.root.mnt)
|
||||||
path_put(&nd.root);
|
path_put(&nd.root);
|
||||||
path_put(&nd.path);
|
|
||||||
return ERR_PTR(error);
|
return ERR_PTR(error);
|
||||||
|
|
||||||
do_link:
|
do_link:
|
||||||
@ -1905,8 +1902,6 @@ struct file *do_filp_open(int dfd, const char *pathname,
|
|||||||
return ERR_PTR(error);
|
return ERR_PTR(error);
|
||||||
}
|
}
|
||||||
nd.flags &= ~LOOKUP_PARENT;
|
nd.flags &= ~LOOKUP_PARENT;
|
||||||
if (nd.last_type == LAST_BIND)
|
|
||||||
goto ok;
|
|
||||||
filp = do_last(&nd, &path, open_flag, acc_mode, mode,
|
filp = do_last(&nd, &path, open_flag, acc_mode, mode,
|
||||||
pathname, &is_link);
|
pathname, &is_link);
|
||||||
if (nd.last_type == LAST_NORM)
|
if (nd.last_type == LAST_NORM)
|
||||||
|
Loading…
Reference in New Issue
Block a user