From: Michael Halcrow Signed-off-by: Michael Halcrow Cc: Christoph Hellwig Signed-off-by: Andrew Morton --- fs/ecryptfs/dentry.c | 18 +++++++----------- fs/ecryptfs/inode.c | 14 +++++--------- 2 files changed, 12 insertions(+), 20 deletions(-) diff -puN fs/ecryptfs/dentry.c~ecryptfs-dont-muck-with-the-existing-nameidata-structures fs/ecryptfs/dentry.c --- a/fs/ecryptfs/dentry.c~ecryptfs-dont-muck-with-the-existing-nameidata-structures +++ a/fs/ecryptfs/dentry.c @@ -41,23 +41,19 @@ */ static int ecryptfs_d_revalidate(struct dentry *dentry, struct nameidata *nd) { - int err = 1; + int rc = 1; struct dentry *lower_dentry; - struct dentry *saved_dentry; - struct vfsmount *saved_vfsmount; + struct nameidata lower_nd; lower_dentry = ecryptfs_dentry_to_lower(dentry); if (!lower_dentry->d_op || !lower_dentry->d_op->d_revalidate) goto out; - saved_dentry = nd->dentry; - saved_vfsmount = nd->mnt; - nd->dentry = lower_dentry; - nd->mnt = ecryptfs_superblock_to_private(dentry->d_sb)->lower_mnt; - err = lower_dentry->d_op->d_revalidate(lower_dentry, nd); - nd->dentry = saved_dentry; - nd->mnt = saved_vfsmount; + memcpy(&lower_nd, nd, sizeof(struct nameidata)); + lower_nd.dentry = lower_dentry; + lower_nd.mnt = ecryptfs_superblock_to_private(dentry->d_sb)->lower_mnt; + rc = lower_dentry->d_op->d_revalidate(lower_dentry, &lower_nd); out: - return err; + return rc; } struct kmem_cache *ecryptfs_dentry_info_cache; diff -puN fs/ecryptfs/inode.c~ecryptfs-dont-muck-with-the-existing-nameidata-structures fs/ecryptfs/inode.c --- a/fs/ecryptfs/inode.c~ecryptfs-dont-muck-with-the-existing-nameidata-structures +++ a/fs/ecryptfs/inode.c @@ -115,17 +115,13 @@ ecryptfs_create_underlying_file(struct i struct nameidata *nd) { int rc; - struct dentry *saved_dentry = NULL; - struct vfsmount *saved_vfsmount = NULL; + struct nameidata lower_nd; - saved_dentry = nd->dentry; - saved_vfsmount = nd->mnt; - nd->dentry = lower_dentry; - nd->mnt = ecryptfs_superblock_to_private( + memcpy(&lower_nd, nd, sizeof(struct nameidata)); + lower_nd.dentry = lower_dentry; + lower_nd.mnt = ecryptfs_superblock_to_private( ecryptfs_dentry->d_sb)->lower_mnt; - rc = vfs_create(lower_dir_inode, lower_dentry, mode, nd); - nd->dentry = saved_dentry; - nd->mnt = saved_vfsmount; + rc = vfs_create(lower_dir_inode, lower_dentry, mode, &lower_nd); return rc; } _