Commit 0612d9fb authored by OGAWA Hirofumi's avatar OGAWA Hirofumi Committed by Al Viro

[PATCH vfs-2.6 5/6] vfs: remove LOOKUP_PARENT from non LOOKUP_PARENT lookup

lookup_hash() with LOOKUP_PARENT is bogus. And this prepares to add
new intent on those path.

The user of LOOKUP_PARENT intent is nfs only, and it checks whether
nd->flags has LOOKUP_CREATE or LOOKUP_OPEN, so the result is same.
Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
parent 8f3dfaa5
...@@ -2180,6 +2180,9 @@ static long do_rmdir(int dfd, const char __user *pathname) ...@@ -2180,6 +2180,9 @@ static long do_rmdir(int dfd, const char __user *pathname)
error = -EBUSY; error = -EBUSY;
goto exit1; goto exit1;
} }
nd.flags &= ~LOOKUP_PARENT;
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);
error = PTR_ERR(dentry); error = PTR_ERR(dentry);
...@@ -2257,6 +2260,9 @@ static long do_unlinkat(int dfd, const char __user *pathname) ...@@ -2257,6 +2260,9 @@ static long do_unlinkat(int dfd, const char __user *pathname)
error = -EISDIR; error = -EISDIR;
if (nd.last_type != LAST_NORM) if (nd.last_type != LAST_NORM)
goto exit1; goto exit1;
nd.flags &= ~LOOKUP_PARENT;
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);
error = PTR_ERR(dentry); error = PTR_ERR(dentry);
...@@ -2646,6 +2652,9 @@ asmlinkage long sys_renameat(int olddfd, const char __user *oldname, ...@@ -2646,6 +2652,9 @@ asmlinkage long sys_renameat(int olddfd, const char __user *oldname,
if (newnd.last_type != LAST_NORM) if (newnd.last_type != LAST_NORM)
goto exit2; goto exit2;
oldnd.flags &= ~LOOKUP_PARENT;
newnd.flags &= ~LOOKUP_PARENT;
trap = lock_rename(new_dir, old_dir); trap = lock_rename(new_dir, old_dir);
old_dentry = lookup_hash(&oldnd); old_dentry = lookup_hash(&oldnd);
......
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