linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: linux-nfs@vger.kernel.org, ecryptfs-devel@lists.launchpad.net,
	ecryptfs@vger.kernel.org
Subject: [PATCH] NFS: Allow NULL nameidata in d_revalidate and create
Date: Thu,  5 May 2011 10:35:41 -0500	[thread overview]
Message-ID: <1304609741-12541-1-git-send-email-tyhicks@linux.vnet.ibm.com> (raw)

To add support for eCryptfs mounts on top of NFS client mounts, the NFS
client must properly handle NULL nameidata pointers in its d_revalidate
functions.

NFS clients should also handle NULL nameidata in its create functions,
although this is not currently required for eCryptfs support.

Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
---
 fs/nfs/dir.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 7237672..03c6ab2 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1095,7 +1095,7 @@ static int nfs_lookup_revalidate(struct dentry *dentry, struct nameidata *nd)
 	struct nfs_fattr *fattr = NULL;
 	int error;
 
-	if (nd->flags & LOOKUP_RCU)
+	if (nd && nd->flags & LOOKUP_RCU)
 		return -ECHILD;
 
 	parent = dget_parent(dentry);
@@ -1493,7 +1493,7 @@ static int nfs_open_revalidate(struct dentry *dentry, struct nameidata *nd)
 	struct nfs_open_context *ctx;
 	int openflags, ret = 0;
 
-	if (nd->flags & LOOKUP_RCU)
+	if (nd && nd->flags & LOOKUP_RCU)
 		return -ECHILD;
 
 	inode = dentry->d_inode;
@@ -1583,7 +1583,7 @@ static int nfs_open_create(struct inode *dir, struct dentry *dentry, int mode,
 	attr.ia_mode = mode;
 	attr.ia_valid = ATTR_MODE;
 
-	if ((nd->flags & LOOKUP_CREATE) != 0) {
+	if (nd && (nd->flags & LOOKUP_CREATE) != 0) {
 		open_flags = nd->intent.open.flags;
 
 		ctx = nameidata_to_nfs_open_context(dentry, nd);
@@ -1673,7 +1673,7 @@ static int nfs_create(struct inode *dir, struct dentry *dentry, int mode,
 	attr.ia_mode = mode;
 	attr.ia_valid = ATTR_MODE;
 
-	if ((nd->flags & LOOKUP_CREATE) != 0)
+	if (nd && (nd->flags & LOOKUP_CREATE) != 0)
 		open_flags = nd->intent.open.flags;
 
 	error = NFS_PROTO(dir)->create(dir, dentry, &attr, open_flags, NULL);
-- 
1.7.4.4


             reply	other threads:[~2011-05-05 15:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-05 15:35 Tyler Hicks [this message]
2011-05-05 15:57 ` [PATCH] NFS: Allow NULL nameidata in d_revalidate and create Tyler Hicks
2011-05-05 16:36   ` Trond Myklebust
2011-05-05 18:58     ` Tyler Hicks
2011-05-05 19:08       ` Trond Myklebust
2011-05-05 22:02         ` Tyler Hicks

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=1304609741-12541-1-git-send-email-tyhicks@linux.vnet.ibm.com \
    --to=tyhicks@linux.vnet.ibm.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=ecryptfs-devel@lists.launchpad.net \
    --cc=ecryptfs@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).