diff options
| -rw-r--r-- | fs/namei.c | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/fs/namei.c b/fs/namei.c index 125386c250bb..998d5316921a 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
| @@ -2249,37 +2249,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
| 2249 | 2249 | ||
| 2250 | inode = path->dentry->d_inode; | 2250 | inode = path->dentry->d_inode; |
| 2251 | } | 2251 | } |
| 2252 | error = -ENOENT; | 2252 | goto finish_lookup; |
| 2253 | if (!inode) { | ||
| 2254 | path_to_nameidata(path, nd); | ||
| 2255 | goto exit; | ||
| 2256 | } | ||
| 2257 | |||
| 2258 | if (should_follow_link(inode, !symlink_ok)) { | ||
| 2259 | if (nd->flags & LOOKUP_RCU) { | ||
| 2260 | if (unlikely(unlazy_walk(nd, path->dentry))) { | ||
| 2261 | error = -ECHILD; | ||
| 2262 | goto exit; | ||
| 2263 | } | ||
| 2264 | } | ||
| 2265 | BUG_ON(inode != path->dentry->d_inode); | ||
| 2266 | return NULL; | ||
| 2267 | } | ||
| 2268 | path_to_nameidata(path, nd); | ||
| 2269 | nd->inode = inode; | ||
| 2270 | |||
| 2271 | /* sayonara */ | ||
| 2272 | error = complete_walk(nd); | ||
| 2273 | if (error) | ||
| 2274 | return ERR_PTR(error); | ||
| 2275 | |||
| 2276 | error = -ENOTDIR; | ||
| 2277 | if (nd->flags & LOOKUP_DIRECTORY) { | ||
| 2278 | if (!nd->inode->i_op->lookup) | ||
| 2279 | goto exit; | ||
| 2280 | } | ||
| 2281 | audit_inode(pathname, nd->path.dentry); | ||
| 2282 | goto ok; | ||
| 2283 | } | 2253 | } |
| 2284 | 2254 | ||
| 2285 | /* create side of things */ | 2255 | /* create side of things */ |
| @@ -2360,6 +2330,8 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
| 2360 | 2330 | ||
| 2361 | BUG_ON(nd->flags & LOOKUP_RCU); | 2331 | BUG_ON(nd->flags & LOOKUP_RCU); |
| 2362 | inode = path->dentry->d_inode; | 2332 | inode = path->dentry->d_inode; |
| 2333 | finish_lookup: | ||
| 2334 | /* we _can_ be in RCU mode here */ | ||
| 2363 | error = -ENOENT; | 2335 | error = -ENOENT; |
| 2364 | if (!inode) { | 2336 | if (!inode) { |
| 2365 | path_to_nameidata(path, nd); | 2337 | path_to_nameidata(path, nd); |
