diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2012-05-21 11:30:07 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-06-01 12:11:57 -0400 |
commit | a1eb33153090549e622ab42cb375af06614dd7a8 (patch) | |
tree | 905f4a840fb12aea792af9a00f72450601baa70d /fs/namei.c | |
parent | e276ae672fa2d727721b1a5a2508ff34bac85439 (diff) |
vfs: do_last(): inline walk_component()
Copy walk_component() into do_lookup().
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/fs/namei.c b/fs/namei.c index edc18cd63a88..f6b31c94c110 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2200,6 +2200,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
2200 | int want_write = 0; | 2200 | int want_write = 0; |
2201 | int acc_mode = op->acc_mode; | 2201 | int acc_mode = op->acc_mode; |
2202 | struct file *filp; | 2202 | struct file *filp; |
2203 | struct inode *inode; | ||
2203 | int error; | 2204 | int error; |
2204 | 2205 | ||
2205 | nd->flags &= ~LOOKUP_PARENT; | 2206 | nd->flags &= ~LOOKUP_PARENT; |
@@ -2237,12 +2238,36 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
2237 | if (open_flag & O_PATH && !(nd->flags & LOOKUP_FOLLOW)) | 2238 | if (open_flag & O_PATH && !(nd->flags & LOOKUP_FOLLOW)) |
2238 | symlink_ok = 1; | 2239 | symlink_ok = 1; |
2239 | /* we _can_ be in RCU mode here */ | 2240 | /* we _can_ be in RCU mode here */ |
2240 | error = walk_component(nd, path, &nd->last, LAST_NORM, | 2241 | error = lookup_fast(nd, &nd->last, path, &inode); |
2241 | !symlink_ok); | 2242 | if (unlikely(error)) { |
2242 | if (error < 0) | 2243 | if (error < 0) |
2243 | return ERR_PTR(error); | 2244 | goto exit; |
2244 | if (error) /* symlink */ | 2245 | |
2246 | error = lookup_slow(nd, &nd->last, path); | ||
2247 | if (error < 0) | ||
2248 | goto exit; | ||
2249 | |||
2250 | inode = path->dentry->d_inode; | ||
2251 | } | ||
2252 | error = -ENOENT; | ||
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); | ||
2245 | return NULL; | 2266 | return NULL; |
2267 | } | ||
2268 | path_to_nameidata(path, nd); | ||
2269 | nd->inode = inode; | ||
2270 | |||
2246 | /* sayonara */ | 2271 | /* sayonara */ |
2247 | error = complete_walk(nd); | 2272 | error = complete_walk(nd); |
2248 | if (error) | 2273 | if (error) |