Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 185920
b: refs/heads/master
c: a1e2803
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro committed Mar 5, 2010
1 parent 4d33d18 commit 872adc6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 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: c41c14056210e4a328659c82b1edaccb0910d18c
refs/heads/master: a1e28038df98e186807ff55a49c1c26d33d530a5
21 changes: 9 additions & 12 deletions trunk/fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -1648,13 +1648,19 @@ static struct file *finish_open(struct nameidata *nd,
static struct file *do_last(struct nameidata *nd, struct path *path,
int open_flag, int flag, int acc_mode,
int mode, const char *pathname,
struct dentry *dir, int *is_link)
int *is_link)
{
struct dentry *dir = nd->path.dentry;
struct file *filp;
int error;

*is_link = 0;

mutex_lock(&dir->d_inode->i_mutex);

path->dentry = lookup_hash(nd);
path->mnt = nd->path.mnt;

error = PTR_ERR(path->dentry);
if (IS_ERR(path->dentry)) {
mutex_unlock(&dir->d_inode->i_mutex);
Expand Down Expand Up @@ -1749,7 +1755,6 @@ struct file *do_filp_open(int dfd, const char *pathname,
struct nameidata nd;
int error;
struct path path;
struct dentry *dir;
int count = 0;
int flag = open_to_namei_flags(open_flag);
int force_reval = 0;
Expand Down Expand Up @@ -1837,16 +1842,12 @@ struct file *do_filp_open(int dfd, const char *pathname,
filp->f_flags = open_flag;
nd.intent.open.flags = flag;
nd.intent.open.create_mode = mode;
dir = nd.path.dentry;
nd.flags &= ~LOOKUP_PARENT;
nd.flags |= LOOKUP_CREATE | LOOKUP_OPEN;
if (flag & O_EXCL)
nd.flags |= LOOKUP_EXCL;
mutex_lock(&dir->d_inode->i_mutex);
path.dentry = lookup_hash(&nd);
path.mnt = nd.path.mnt;
filp = do_last(&nd, &path, open_flag, flag, acc_mode, mode,
pathname, dir, &is_link);
pathname, &is_link);
if (is_link)
goto do_link;
if (nd.root.mnt)
Expand Down Expand Up @@ -1919,12 +1920,8 @@ struct file *do_filp_open(int dfd, const char *pathname,
__putname(nd.last.name);
goto exit;
}
dir = nd.path.dentry;
mutex_lock(&dir->d_inode->i_mutex);
path.dentry = lookup_hash(&nd);
path.mnt = nd.path.mnt;
filp = do_last(&nd, &path, open_flag, flag, acc_mode, mode,
pathname, dir, &is_link);
pathname, &is_link);
__putname(nd.last.name);
if (is_link)
goto do_link;
Expand Down

0 comments on commit 872adc6

Please sign in to comment.