linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-nfs@vger.kernel.org
Cc: ebiederm@xmission.com, adobriyan@gmail.com,
	viro@ZenIV.linux.org.uk, jamie@shareable.org
Subject: [PATCH 2/2] vfs: force reval on dentry of bind mounted files for LOOKUP_OPEN
Date: Tue, 10 Nov 2009 11:27:36 -0500	[thread overview]
Message-ID: <1257870456-31188-3-git-send-email-jlayton@redhat.com> (raw)
In-Reply-To: <1257870456-31188-1-git-send-email-jlayton@redhat.com>

In the case of a bind mounted file, the path walking code will assume
that a cached dentry is valid and doesn't revalidate it. This is a
problem for NFSv4 in a way that's similar to LAST_BIND symlinks.

Fix this by revalidating the dentry if LOOKUP_OPEN is set and
__follow_mount returns true.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/namei.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 5c8ef80..b7c9747 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -839,6 +839,7 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
 {
 	struct vfsmount *mnt = nd->path.mnt;
 	struct dentry *dentry = __d_lookup(nd->path.dentry, name);
+	int error = 0;
 
 	if (!dentry)
 		goto need_lookup;
@@ -847,8 +848,9 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
 done:
 	path->mnt = mnt;
 	path->dentry = dentry;
-	__follow_mount(path);
-	return 0;
+	if (__follow_mount(path))
+		error = open_reval_path(path, nd);
+	return error;
 
 need_lookup:
 	dentry = real_lookup(nd->path.dentry, name, nd);
@@ -1836,6 +1838,9 @@ do_last:
 		error = -ELOOP;
 		if (flag & O_NOFOLLOW)
 			goto exit_dput;
+		error = open_reval_path(&path, &nd);
+		if (error)
+			goto exit;
 	}
 
 	error = -ENOENT;
-- 
1.5.5.6


  parent reply	other threads:[~2009-11-10 16:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-10 16:27 [PATCH 0/2] vfs: ensure that dentries are revalidated on open (try #2) Jeff Layton
2009-11-10 16:27 ` [PATCH 1/2] vfs: force reval of dentries for LAST_BIND symlinks on open Jeff Layton
2009-11-10 16:27 ` Jeff Layton [this message]
     [not found] ` <1257870456-31188-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-11-11  7:57   ` [PATCH 0/2] vfs: ensure that dentries are revalidated on open (try #2) Miklos Szeredi
2009-11-11  8:26     ` Trond Myklebust
     [not found]       ` <1257927970.5138.24.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-11-11  8:33         ` Miklos Szeredi
2009-11-11 12:17           ` Trond Myklebust
2009-11-11 12:36         ` Jeff Layton
2009-11-18  4:19   ` Pavel Machek
2009-11-18 12:29     ` Jeff Layton

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=1257870456-31188-3-git-send-email-jlayton@redhat.com \
    --to=jlayton@redhat.com \
    --cc=adobriyan@gmail.com \
    --cc=ebiederm@xmission.com \
    --cc=jamie@shareable.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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).