Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 310056
b: refs/heads/master
c: a1eb331
h: refs/heads/master
v: v3
  • Loading branch information
Miklos Szeredi authored and Al Viro committed Jun 1, 2012
1 parent 25a2f95 commit 95b1f70
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e276ae672fa2d727721b1a5a2508ff34bac85439
refs/heads/master: a1eb33153090549e622ab42cb375af06614dd7a8
35 changes: 30 additions & 5 deletions trunk/fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -2200,6 +2200,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
int want_write = 0;
int acc_mode = op->acc_mode;
struct file *filp;
struct inode *inode;
int error;

nd->flags &= ~LOOKUP_PARENT;
Expand Down Expand Up @@ -2237,12 +2238,36 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
if (open_flag & O_PATH && !(nd->flags & LOOKUP_FOLLOW))
symlink_ok = 1;
/* we _can_ be in RCU mode here */
error = walk_component(nd, path, &nd->last, LAST_NORM,
!symlink_ok);
if (error < 0)
return ERR_PTR(error);
if (error) /* symlink */
error = lookup_fast(nd, &nd->last, path, &inode);
if (unlikely(error)) {
if (error < 0)
goto exit;

error = lookup_slow(nd, &nd->last, path);
if (error < 0)
goto exit;

inode = path->dentry->d_inode;
}
error = -ENOENT;
if (!inode) {
path_to_nameidata(path, nd);
goto exit;
}

if (should_follow_link(inode, !symlink_ok)) {
if (nd->flags & LOOKUP_RCU) {
if (unlikely(unlazy_walk(nd, path->dentry))) {
error = -ECHILD;
goto exit;
}
}
BUG_ON(inode != path->dentry->d_inode);
return NULL;
}
path_to_nameidata(path, nd);
nd->inode = inode;

/* sayonara */
error = complete_walk(nd);
if (error)
Expand Down

0 comments on commit 95b1f70

Please sign in to comment.