GIT: unionfs2-2.6.27.y: fs/unionfs/: Don't duplicate the struct nameidata
Erez Zadok
ezk at fsl.cs.sunysb.edu
Thu Aug 12 23:15:49 EDT 2010
commit aee279534cd883048e7eabe4847cfec9b88da6f6
Author: Josef 'Jeff' Sipek <jsipek at cs.sunysb.edu>
Date: Sun Jan 28 14:20:19 2007 -0500
fs/unionfs/: Don't duplicate the struct nameidata
The only fields that we have to watch out for are the dentry and vfsmount.
Additionally, this makes Unionfs gentler on the stack as nameidata is rather
large.
Signed-off-by: Josef 'Jeff' Sipek <jsipek at cs.sunysb.edu>
diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index 3b4a388..1b2e8a8 100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@ -191,15 +191,25 @@ static struct dentry *unionfs_lookup(struct inode *parent,
struct dentry *dentry,
struct nameidata *nd)
{
- struct nameidata lowernd; /* TODO: be gentler to the stack */
+ struct path path_save;
+ struct dentry *ret;
- if (nd)
- memcpy(&lowernd, nd, sizeof(struct nameidata));
- else
- memset(&lowernd, 0, sizeof(struct nameidata));
+ /* save the dentry & vfsmnt from namei */
+ if (nd) {
+ path_save.dentry = nd->dentry;
+ path_save.mnt = nd->mnt;
+ }
/* The locking is done by unionfs_lookup_backend. */
- return unionfs_lookup_backend(dentry, &lowernd, INTERPOSE_LOOKUP);
+ ret = unionfs_lookup_backend(dentry, nd, INTERPOSE_LOOKUP);
+
+ /* restore the dentry & vfsmnt in namei */
+ if (nd) {
+ nd->dentry = path_save.dentry;
+ nd->mnt = path_save.mnt;
+ }
+
+ return ret;
}
static int unionfs_link(struct dentry *old_dentry, struct inode *dir,
More information about the unionfs-cvs
mailing list