kill opendata->{mnt,dentry}
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 10 Jun 2012 09:55:37 +0000 (05:55 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 14 Jul 2012 12:33:37 +0000 (16:33 +0400)
->filp->f_path is there for purpose...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/internal.h
fs/namei.c
fs/open.c

index ae69a3b150d7ea5e15c4e4b6ddf1ad587c29a910..09003a02292dd22713f07f0bc5605bb844c17ffd 100644 (file)
@@ -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 {
index f0dae0057ec969ec5b5c21888d3f35d6e581e297..af83ede92a4f5cf4ff446de577ecbd73c63eadc7 100644 (file)
@@ -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);
@@ -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;
        }
@@ -2607,7 +2604,7 @@ finish_open_created:
        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))
index c87f98201c2990d572270978c9a6812a98d7a82f..2b1654d8bfbd1fdd669acdf7ba6c16616220b01d 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -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;
 
@@ -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);