Skip to content

Commit

Permalink
don't modify od->filp at all
Browse files Browse the repository at this point in the history
make put_filp() conditional on flag set by finish_open()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Jul 14, 2012
1 parent 4723768 commit 3d8a00d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 1 addition & 3 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -2708,10 +2708,8 @@ static struct file *path_openat(int dfd, const char *pathname,
path_put(&nd->root);
if (base)
fput(base);
if (od.filp) {
BUG_ON(od.filp->f_path.dentry);
if (!(opened & FILE_OPENED))
put_filp(od.filp);
}
if (res == ERR_PTR(-EOPENSTALE)) {
if (flags & LOOKUP_RCU)
res = ERR_PTR(-ECHILD);
Expand Down
5 changes: 2 additions & 3 deletions fs/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,15 +786,14 @@ struct file *finish_open(struct opendata *od, struct dentry *dentry,
int *opened)
{
struct file *res;
BUG_ON(*opened & FILE_OPENED); /* once it's opened, it's opened */

mntget(od->mnt);
dget(dentry);

res = do_dentry_open(dentry, od->mnt, od->filp, open, current_cred());
if (!IS_ERR(res)) {
if (!IS_ERR(res))
*opened |= FILE_OPENED;
od->filp = NULL;
}

return res;
}
Expand Down

0 comments on commit 3d8a00d

Please sign in to comment.