Skip to content

Commit

Permalink
kill opendata->{mnt,dentry}
Browse files Browse the repository at this point in the history
->filp->f_path is there for purpose...

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Jul 14, 2012
1 parent d958527 commit a4a3bdd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
2 changes: 0 additions & 2 deletions fs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ extern struct super_block *user_get_super(dev_t);
* open.c
*/
struct opendata {
struct dentry *dentry;
struct vfsmount *mnt;
struct file *filp;
};
struct open_flags {
Expand Down
15 changes: 6 additions & 9 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -2269,14 +2269,11 @@ static struct file *atomic_open(struct nameidata *nd, struct dentry *dentry,
if (nd->flags & LOOKUP_DIRECTORY)
open_flag |= O_DIRECTORY;

od->dentry = DENTRY_NOT_SET;
od->mnt = nd->path.mnt;
od->filp->f_path.dentry = DENTRY_NOT_SET;
od->filp->f_path.mnt = nd->path.mnt;
error = dir->i_op->atomic_open(dir, dentry, od, open_flag, mode,
opened);
if (error < 0) {
if (WARN_ON(od->dentry != DENTRY_NOT_SET))
dput(od->dentry);

if (create_error && error == -ENOENT)
error = create_error;
filp = ERR_PTR(error);
Expand All @@ -2290,13 +2287,13 @@ static struct file *atomic_open(struct nameidata *nd, struct dentry *dentry,
}

if (error) { /* returned 1, that is */
if (WARN_ON(od->dentry == DENTRY_NOT_SET)) {
if (WARN_ON(od->filp->f_path.dentry == DENTRY_NOT_SET)) {
filp = ERR_PTR(-EIO);
goto out;
}
if (od->dentry) {
if (od->filp->f_path.dentry) {
dput(dentry);
dentry = od->dentry;
dentry = od->filp->f_path.dentry;
}
goto looked_up;
}
Expand Down Expand Up @@ -2607,7 +2604,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
error = may_open(&nd->path, acc_mode, open_flag);
if (error)
goto exit;
od->mnt = nd->path.mnt;
od->filp->f_path.mnt = nd->path.mnt;
filp = finish_open(od, nd->path.dentry, NULL, opened);
if (IS_ERR(filp)) {
if (filp == ERR_PTR(-EOPENSTALE))
Expand Down
6 changes: 3 additions & 3 deletions fs/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -788,10 +788,10 @@ struct file *finish_open(struct opendata *od, struct dentry *dentry,
struct file *res;
BUG_ON(*opened & FILE_OPENED); /* once it's opened, it's opened */

mntget(od->mnt);
mntget(od->filp->f_path.mnt);
dget(dentry);

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

Expand All @@ -810,7 +810,7 @@ EXPORT_SYMBOL(finish_open);
*/
void finish_no_open(struct opendata *od, struct dentry *dentry)
{
od->dentry = dentry;
od->filp->f_path.dentry = dentry;
}
EXPORT_SYMBOL(finish_no_open);

Expand Down

0 comments on commit a4a3bdd

Please sign in to comment.