Commit 0612d9fb270a474fe6a46cc5b8d3f5b71cf5f580
Committed by
Al Viro
1 parent
8f3dfaa5ba
Exists in
master
and in
4 other branches
[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: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Showing 1 changed file with 18 additions and 9 deletions Side-by-side Diff
fs/namei.c
... | ... | @@ -2170,16 +2170,19 @@ |
2170 | 2170 | return error; |
2171 | 2171 | |
2172 | 2172 | switch(nd.last_type) { |
2173 | - case LAST_DOTDOT: | |
2174 | - error = -ENOTEMPTY; | |
2175 | - goto exit1; | |
2176 | - case LAST_DOT: | |
2177 | - error = -EINVAL; | |
2178 | - goto exit1; | |
2179 | - case LAST_ROOT: | |
2180 | - error = -EBUSY; | |
2181 | - goto exit1; | |
2173 | + case LAST_DOTDOT: | |
2174 | + error = -ENOTEMPTY; | |
2175 | + goto exit1; | |
2176 | + case LAST_DOT: | |
2177 | + error = -EINVAL; | |
2178 | + goto exit1; | |
2179 | + case LAST_ROOT: | |
2180 | + error = -EBUSY; | |
2181 | + goto exit1; | |
2182 | 2182 | } |
2183 | + | |
2184 | + nd.flags &= ~LOOKUP_PARENT; | |
2185 | + | |
2183 | 2186 | mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); |
2184 | 2187 | dentry = lookup_hash(&nd); |
2185 | 2188 | error = PTR_ERR(dentry); |
... | ... | @@ -2257,6 +2260,9 @@ |
2257 | 2260 | error = -EISDIR; |
2258 | 2261 | if (nd.last_type != LAST_NORM) |
2259 | 2262 | goto exit1; |
2263 | + | |
2264 | + nd.flags &= ~LOOKUP_PARENT; | |
2265 | + | |
2260 | 2266 | mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); |
2261 | 2267 | dentry = lookup_hash(&nd); |
2262 | 2268 | error = PTR_ERR(dentry); |
... | ... | @@ -2645,6 +2651,9 @@ |
2645 | 2651 | new_dir = newnd.path.dentry; |
2646 | 2652 | if (newnd.last_type != LAST_NORM) |
2647 | 2653 | goto exit2; |
2654 | + | |
2655 | + oldnd.flags &= ~LOOKUP_PARENT; | |
2656 | + newnd.flags &= ~LOOKUP_PARENT; | |
2648 | 2657 | |
2649 | 2658 | trap = lock_rename(new_dir, old_dir); |
2650 | 2659 |