From c2f972f921d53e8a75daa8944fd1ba1450779eb3 Mon Sep 17 00:00:00 2001 From: Erez Zadok Date: Tue, 4 Jun 2013 23:19:28 -0400 Subject: [PATCH] Wrapfs: struct nameidata no longer has an open-intent data Signed-off-by: Erez Zadok --- fs/wrapfs/inode.c | 1 - fs/wrapfs/lookup.c | 45 +++------------------------------------------ fs/wrapfs/wrapfs.h | 1 - 3 files changed, 3 insertions(+), 44 deletions(-) diff --git a/fs/wrapfs/inode.c b/fs/wrapfs/inode.c index 866838e5dca8..6fa57fa7a8ae 100644 --- a/fs/wrapfs/inode.c +++ b/fs/wrapfs/inode.c @@ -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? */ diff --git a/fs/wrapfs/lookup.c b/fs/wrapfs/lookup.c index 92ccd37499ed..04c036d44e54 100644 --- a/fs/wrapfs/lookup.c +++ b/fs/wrapfs/lookup.c @@ -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); diff --git a/fs/wrapfs/wrapfs.h b/fs/wrapfs/wrapfs.h index 5762c3543324..91250b3bac32 100644 --- a/fs/wrapfs/wrapfs.h +++ b/fs/wrapfs/wrapfs.h @@ -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, -- 2.34.1