Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 233136
b: refs/heads/master
c: 2dab597
h: refs/heads/master
v: v3
  • Loading branch information
Linus Torvalds committed Feb 11, 2011
1 parent 5cae0d9 commit f01b6e2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 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: d2478521afc20227658a10a8c5c2bf1a2aa615b3
refs/heads/master: 2dab597441667d6c04451a7dcf215241ad4c74f6
20 changes: 10 additions & 10 deletions trunk/fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,10 +561,14 @@ static inline int nameidata_drop_rcu_last_maybe(struct nameidata *nd)
*/
void release_open_intent(struct nameidata *nd)
{
if (nd->intent.open.file->f_path.dentry == NULL)
put_filp(nd->intent.open.file);
else
fput(nd->intent.open.file);
struct file *file = nd->intent.open.file;

if (file && !IS_ERR(file)) {
if (file->f_path.dentry == NULL)
put_filp(file);
else
fput(file);
}
}

/*
Expand Down Expand Up @@ -2265,8 +2269,6 @@ static struct file *finish_open(struct nameidata *nd,
return filp;

exit:
if (!IS_ERR(nd->intent.open.file))
release_open_intent(nd);
path_put(&nd->path);
return ERR_PTR(error);
}
Expand Down Expand Up @@ -2389,8 +2391,6 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
exit_dput:
path_put_conditional(path, nd);
exit:
if (!IS_ERR(nd->intent.open.file))
release_open_intent(nd);
path_put(&nd->path);
return ERR_PTR(error);
}
Expand Down Expand Up @@ -2477,6 +2477,7 @@ struct file *do_filp_open(int dfd, const char *pathname,
}
audit_inode(pathname, nd.path.dentry);
filp = finish_open(&nd, open_flag, acc_mode);
release_open_intent(&nd);
return filp;

creat:
Expand Down Expand Up @@ -2553,15 +2554,14 @@ struct file *do_filp_open(int dfd, const char *pathname,
path_put(&nd.root);
if (filp == ERR_PTR(-ESTALE) && !(flags & LOOKUP_REVAL))
goto reval;
release_open_intent(&nd);
return filp;

exit_dput:
path_put_conditional(&path, &nd);
out_path:
path_put(&nd.path);
out_filp:
if (!IS_ERR(nd.intent.open.file))
release_open_intent(&nd);
filp = ERR_PTR(error);
goto out;
}
Expand Down
2 changes: 2 additions & 0 deletions trunk/fs/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,8 @@ struct file *nameidata_to_filp(struct nameidata *nd)

/* Pick up the filp from the open intent */
filp = nd->intent.open.file;
nd->intent.open.file = NULL;

/* Has the filesystem initialised the file for us? */
if (filp->f_path.dentry == NULL) {
path_get(&nd->path);
Expand Down

0 comments on commit f01b6e2

Please sign in to comment.