LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Josef 'Jeff' Sipek" <jsipek@cs.sunysb.edu>
To: linux-kernel@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org, akpm@osdl.org,
	"Josef 'Jeff' Sipek" <jsipek@cs.sunysb.edu>
Subject: [PATCH 4/4] fs/unionfs/: Don't duplicate the struct nameidata
Date: Mon, 29 Jan 2007 15:37:42 -0500	[thread overview]
Message-ID: <11701030643398-git-send-email-jsipek@cs.sunysb.edu> (raw)
In-Reply-To: <11701030631109-git-send-email-jsipek@cs.sunysb.edu>

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@cs.sunysb.edu>
---
 fs/unionfs/inode.c |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

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,
-- 
1.5.0.rc1.g5355


  parent reply	other threads:[~2007-01-29 20:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-29 20:37 [GIT PULL -mm] Unionfs updates/cleanups Josef 'Jeff' Sipek
2007-01-29 20:37 ` [PATCH 1/4] fs/unionfs/: Remove stale_inode.c Josef 'Jeff' Sipek
2007-01-29 20:37 ` [PATCH 2/4] fs/unionfs/: possible cleanups Josef 'Jeff' Sipek
2007-01-29 20:37 ` [PATCH 3/4] fs/unionfs/: Andrew Morton's comments Josef 'Jeff' Sipek
2007-01-29 20:37 ` Josef 'Jeff' Sipek [this message]
2007-01-30  9:42   ` [PATCH 4/4] fs/unionfs/: Don't duplicate the struct nameidata Christoph Hellwig
2007-01-30 17:52     ` Josef Sipek
2007-01-29 20:37 ` Josef 'Jeff' Sipek
2007-01-29 20:40   ` Josef Sipek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11701030643398-git-send-email-jsipek@cs.sunysb.edu \
    --to=jsipek@cs.sunysb.edu \
    --cc=akpm@osdl.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH 4/4] fs/unionfs/: Don'\''t duplicate the struct nameidata' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).