mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 19:00:25 +00:00
[PATCH] namei fixes (3/19)
Replaced struct dentry *dentry in namei with struct path path. All uses of dentry replaced with path.dentry there. Obviously equivalent transformation. Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
5f92b3bcec
commit
4e7506e4dd
1 changed files with 19 additions and 19 deletions
38
fs/namei.c
38
fs/namei.c
|
@ -1397,7 +1397,7 @@ int may_open(struct nameidata *nd, int acc_mode, int flag)
|
||||||
int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
|
int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
|
||||||
{
|
{
|
||||||
int acc_mode, error = 0;
|
int acc_mode, error = 0;
|
||||||
struct dentry *dentry;
|
struct path path;
|
||||||
struct dentry *dir;
|
struct dentry *dir;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
@ -1441,23 +1441,23 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
|
||||||
dir = nd->dentry;
|
dir = nd->dentry;
|
||||||
nd->flags &= ~LOOKUP_PARENT;
|
nd->flags &= ~LOOKUP_PARENT;
|
||||||
down(&dir->d_inode->i_sem);
|
down(&dir->d_inode->i_sem);
|
||||||
dentry = __lookup_hash(&nd->last, nd->dentry, nd);
|
path.dentry = __lookup_hash(&nd->last, nd->dentry, nd);
|
||||||
|
|
||||||
do_last:
|
do_last:
|
||||||
error = PTR_ERR(dentry);
|
error = PTR_ERR(path.dentry);
|
||||||
if (IS_ERR(dentry)) {
|
if (IS_ERR(path.dentry)) {
|
||||||
up(&dir->d_inode->i_sem);
|
up(&dir->d_inode->i_sem);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Negative dentry, just create the file */
|
/* Negative dentry, just create the file */
|
||||||
if (!dentry->d_inode) {
|
if (!path.dentry->d_inode) {
|
||||||
if (!IS_POSIXACL(dir->d_inode))
|
if (!IS_POSIXACL(dir->d_inode))
|
||||||
mode &= ~current->fs->umask;
|
mode &= ~current->fs->umask;
|
||||||
error = vfs_create(dir->d_inode, dentry, mode, nd);
|
error = vfs_create(dir->d_inode, path.dentry, mode, nd);
|
||||||
up(&dir->d_inode->i_sem);
|
up(&dir->d_inode->i_sem);
|
||||||
dput(nd->dentry);
|
dput(nd->dentry);
|
||||||
nd->dentry = dentry;
|
nd->dentry = path.dentry;
|
||||||
if (error)
|
if (error)
|
||||||
goto exit;
|
goto exit;
|
||||||
/* Don't check for write permission, don't truncate */
|
/* Don't check for write permission, don't truncate */
|
||||||
|
@ -1475,22 +1475,22 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
|
||||||
if (flag & O_EXCL)
|
if (flag & O_EXCL)
|
||||||
goto exit_dput;
|
goto exit_dput;
|
||||||
|
|
||||||
if (d_mountpoint(dentry)) {
|
if (d_mountpoint(path.dentry)) {
|
||||||
error = -ELOOP;
|
error = -ELOOP;
|
||||||
if (flag & O_NOFOLLOW)
|
if (flag & O_NOFOLLOW)
|
||||||
goto exit_dput;
|
goto exit_dput;
|
||||||
while (__follow_down(&nd->mnt,&dentry) && d_mountpoint(dentry));
|
while (__follow_down(&nd->mnt,&path.dentry) && d_mountpoint(path.dentry));
|
||||||
}
|
}
|
||||||
error = -ENOENT;
|
error = -ENOENT;
|
||||||
if (!dentry->d_inode)
|
if (!path.dentry->d_inode)
|
||||||
goto exit_dput;
|
goto exit_dput;
|
||||||
if (dentry->d_inode->i_op && dentry->d_inode->i_op->follow_link)
|
if (path.dentry->d_inode->i_op && path.dentry->d_inode->i_op->follow_link)
|
||||||
goto do_link;
|
goto do_link;
|
||||||
|
|
||||||
dput(nd->dentry);
|
dput(nd->dentry);
|
||||||
nd->dentry = dentry;
|
nd->dentry = path.dentry;
|
||||||
error = -EISDIR;
|
error = -EISDIR;
|
||||||
if (dentry->d_inode && S_ISDIR(dentry->d_inode->i_mode))
|
if (path.dentry->d_inode && S_ISDIR(path.dentry->d_inode->i_mode))
|
||||||
goto exit;
|
goto exit;
|
||||||
ok:
|
ok:
|
||||||
error = may_open(nd, acc_mode, flag);
|
error = may_open(nd, acc_mode, flag);
|
||||||
|
@ -1499,7 +1499,7 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
exit_dput:
|
exit_dput:
|
||||||
dput(dentry);
|
dput(path.dentry);
|
||||||
exit:
|
exit:
|
||||||
path_release(nd);
|
path_release(nd);
|
||||||
return error;
|
return error;
|
||||||
|
@ -1519,16 +1519,16 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
|
||||||
* are done. Procfs-like symlinks just set LAST_BIND.
|
* are done. Procfs-like symlinks just set LAST_BIND.
|
||||||
*/
|
*/
|
||||||
nd->flags |= LOOKUP_PARENT;
|
nd->flags |= LOOKUP_PARENT;
|
||||||
error = security_inode_follow_link(dentry, nd);
|
error = security_inode_follow_link(path.dentry, nd);
|
||||||
if (error)
|
if (error)
|
||||||
goto exit_dput;
|
goto exit_dput;
|
||||||
error = __do_follow_link(dentry, nd);
|
error = __do_follow_link(path.dentry, nd);
|
||||||
dput(dentry);
|
dput(path.dentry);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
nd->flags &= ~LOOKUP_PARENT;
|
nd->flags &= ~LOOKUP_PARENT;
|
||||||
if (nd->last_type == LAST_BIND) {
|
if (nd->last_type == LAST_BIND) {
|
||||||
dentry = nd->dentry;
|
path.dentry = nd->dentry;
|
||||||
goto ok;
|
goto ok;
|
||||||
}
|
}
|
||||||
error = -EISDIR;
|
error = -EISDIR;
|
||||||
|
@ -1545,7 +1545,7 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
|
||||||
}
|
}
|
||||||
dir = nd->dentry;
|
dir = nd->dentry;
|
||||||
down(&dir->d_inode->i_sem);
|
down(&dir->d_inode->i_sem);
|
||||||
dentry = __lookup_hash(&nd->last, nd->dentry, nd);
|
path.dentry = __lookup_hash(&nd->last, nd->dentry, nd);
|
||||||
putname(nd->last.name);
|
putname(nd->last.name);
|
||||||
goto do_last;
|
goto do_last;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue