Commit 6a9f40d6 authored by Al Viro's avatar Al Viro

namei: get rid of lookup_hash()

it's a convenient helper, but we'll want to shift nameidata
down the call chain, so it won't be available there...
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent a5cfe2d5
...@@ -2128,16 +2128,6 @@ int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, ...@@ -2128,16 +2128,6 @@ int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt,
} }
EXPORT_SYMBOL(vfs_path_lookup); EXPORT_SYMBOL(vfs_path_lookup);
/*
* Restricted form of lookup. Doesn't follow links, single-component only,
* needs parent already locked. Doesn't follow mounts.
* SMP-safe.
*/
static struct dentry *lookup_hash(struct nameidata *nd)
{
return __lookup_hash(&nd->last, nd->path.dentry, nd->flags);
}
/** /**
* lookup_one_len - filesystem helper to lookup single pathname component * lookup_one_len - filesystem helper to lookup single pathname component
* @name: pathname component to lookup * @name: pathname component to lookup
...@@ -3351,7 +3341,7 @@ static struct dentry *filename_create(int dfd, struct filename *name, ...@@ -3351,7 +3341,7 @@ static struct dentry *filename_create(int dfd, struct filename *name,
* Do the final lookup. * Do the final lookup.
*/ */
mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT);
dentry = lookup_hash(&nd); dentry = __lookup_hash(&nd.last, nd.path.dentry, nd.flags);
if (IS_ERR(dentry)) if (IS_ERR(dentry))
goto unlock; goto unlock;
...@@ -3665,7 +3655,7 @@ static long do_rmdir(int dfd, const char __user *pathname) ...@@ -3665,7 +3655,7 @@ static long do_rmdir(int dfd, const char __user *pathname)
goto exit1; goto exit1;
mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT);
dentry = lookup_hash(&nd); dentry = __lookup_hash(&nd.last, nd.path.dentry, nd.flags);
error = PTR_ERR(dentry); error = PTR_ERR(dentry);
if (IS_ERR(dentry)) if (IS_ERR(dentry))
goto exit2; goto exit2;
...@@ -3785,7 +3775,7 @@ static long do_unlinkat(int dfd, const char __user *pathname) ...@@ -3785,7 +3775,7 @@ static long do_unlinkat(int dfd, const char __user *pathname)
goto exit1; goto exit1;
retry_deleg: retry_deleg:
mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT);
dentry = lookup_hash(&nd); dentry = __lookup_hash(&nd.last, nd.path.dentry, nd.flags);
error = PTR_ERR(dentry); error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) { if (!IS_ERR(dentry)) {
/* Why not before? Because we want correct error value */ /* Why not before? Because we want correct error value */
...@@ -4304,7 +4294,7 @@ SYSCALL_DEFINE5(renameat2, int, olddfd, const char __user *, oldname, ...@@ -4304,7 +4294,7 @@ SYSCALL_DEFINE5(renameat2, int, olddfd, const char __user *, oldname,
retry_deleg: retry_deleg:
trap = lock_rename(new_dir, old_dir); trap = lock_rename(new_dir, old_dir);
old_dentry = lookup_hash(&oldnd); old_dentry = __lookup_hash(&oldnd.last, oldnd.path.dentry, oldnd.flags);
error = PTR_ERR(old_dentry); error = PTR_ERR(old_dentry);
if (IS_ERR(old_dentry)) if (IS_ERR(old_dentry))
goto exit3; goto exit3;
...@@ -4312,7 +4302,7 @@ SYSCALL_DEFINE5(renameat2, int, olddfd, const char __user *, oldname, ...@@ -4312,7 +4302,7 @@ SYSCALL_DEFINE5(renameat2, int, olddfd, const char __user *, oldname,
error = -ENOENT; error = -ENOENT;
if (d_is_negative(old_dentry)) if (d_is_negative(old_dentry))
goto exit4; goto exit4;
new_dentry = lookup_hash(&newnd); new_dentry = __lookup_hash(&newnd.last, newnd.path.dentry, newnd.flags);
error = PTR_ERR(new_dentry); error = PTR_ERR(new_dentry);
if (IS_ERR(new_dentry)) if (IS_ERR(new_dentry))
goto exit4; goto exit4;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment