Wrapfs: struct nameidata no longer has an open-intent data
authorErez Zadok <ezk@cs.sunysb.edu>
Wed, 5 Jun 2013 03:19:28 +0000 (23:19 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Tue, 27 Dec 2016 19:05:02 +0000 (14:05 -0500)
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/wrapfs/inode.c
fs/wrapfs/lookup.c
fs/wrapfs/wrapfs.h

index 866838e5dca8b31e07189fcfa6dfe47c9fbed432..6fa57fa7a8ae10683f41211f6b85b2575eaa99cb 100644 (file)
@@ -33,7 +33,6 @@ static int wrapfs_create(struct inode *dir, struct dentry *dentry,
                goto out;
        err = vfs_create(lower_parent_dentry->d_inode, lower_dentry, mode,
                         &lower_nd);
-       release_lower_nd(&lower_nd, err);
        if (err)
                goto out;
        /* XXX; should we pass lower_nd.path instead of lower_path? */
index 92ccd37499ed98f1b3adfd661a54f7ae65456543..04c036d44e54159571a180672243782f54aa749e 100644 (file)
@@ -57,70 +57,31 @@ int new_dentry_private_data(struct dentry *dentry)
 /*
  * Initialize a nameidata structure (the intent part) we can pass to a lower
  * file system.  Returns 0 on success or -error (only -ENOMEM possible).
- * Inside that nd structure, this function may also return an allocated
- * struct file (for open intents).  The caller, when done with this nd, must
- * kfree the intent file (using release_lower_nd).
- *
- * XXX: this code, and the callers of this code, should be redone using
- * vfs_path_lookup() when (1) the nameidata structure is refactored into a
- * separate intent-structure, and (2) open_namei() is broken into a VFS-only
- * function and a method that other file systems can call.
  */
 int init_lower_nd(struct nameidata *nd, unsigned int flags)
 {
        int err = 0;
-#ifdef ALLOC_LOWER_ND_FILE
-       /*
-        * XXX: one day we may need to have the lower file system return an
-        * open file for us (esp. for nfs4).
-        */
-       struct file *file;
-#endif /* ALLOC_LOWER_ND_FILE */
 
        memset(nd, 0, sizeof(struct nameidata));
        if (!flags)
-               return err;
+               goto out;
 
        switch (flags) {
        case LOOKUP_CREATE:
-               nd->intent.open.flags |= O_CREAT;
-               /* fall through: shared code for create/open cases */
        case LOOKUP_OPEN:
                nd->flags = flags;
-               nd->intent.open.flags |= (FMODE_READ | FMODE_WRITE);
-#ifdef ALLOC_LOWER_ND_FILE
-               file = kzalloc(sizeof(struct file), GFP_KERNEL);
-               if (!file) {
-                       err = -ENOMEM;
-                       break; /* exit switch statement and thus return */
-               }
-               nd->intent.open.file = file;
-#endif /* ALLOC_LOWER_ND_FILE */
                break;
        default:
-               /*
-                * We should never get here, for now.
-                * We can add new cases here later on.
-                */
+               /* We should never get here, for now */
                pr_debug("wrapfs: unknown nameidata flag 0x%x\n", flags);
                BUG();
                break;
        }
 
+out:
        return err;
 }
 
-void release_lower_nd(struct nameidata *nd, int err)
-{
-       if (!nd->intent.open.file)
-               return;
-       else if (!err)
-               release_open_intent(nd);
-#ifdef ALLOC_LOWER_ND_FILE
-       kfree(nd->intent.open.file);
-#endif /* ALLOC_LOWER_ND_FILE */
-}
-
 static int wrapfs_inode_test(struct inode *inode, void *candidate_lower_inode)
 {
        struct inode *current_lower_inode = wrapfs_lower_inode(inode);
index 5762c35433247832e159d9a3109e22192dd59bbb..91250b3bac321f883ed43f167cb5c1ee7daf70c9 100644 (file)
@@ -53,7 +53,6 @@ extern void wrapfs_destroy_dentry_cache(void);
 extern int new_dentry_private_data(struct dentry *dentry);
 extern void free_dentry_private_data(struct dentry *dentry);
 extern int init_lower_nd(struct nameidata *nd, unsigned int flags);
-extern void release_lower_nd(struct nameidata *nd, int err);
 extern struct dentry *wrapfs_lookup(struct inode *dir, struct dentry *dentry,
                                    struct nameidata *nd);
 extern struct inode *wrapfs_iget(struct super_block *sb,