linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org
Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	chutzpah-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org,
	liguangc-vtt25B2cwJLQT0dZR+AlfA@public.gmane.org
Subject: [PATCH] [RFC] vfs: don't revalidate dentries that serve as mountpoints
Date: Mon,  4 Nov 2013 20:16:26 -0500	[thread overview]
Message-ID: <1383614186-8039-1-git-send-email-jlayton@redhat.com> (raw)

We had a couple of reports of people that are mounting NFS filesystems,
and then bind mounting certain local files onto dentries in that nfs
mount (sort of like a poor-man's unionmount).

This all works well until the dentry serving as the mountpoint fails
d_revalidate. The dentry will end up being invalidated which makes the
bind mount unreachable via pathwalk.

It doesn't make much sense to me to allow dentries to serve as
mountpoints to end up invalidated, so there's no real point in
attempting to d_revalidate them at all.

Reported-by: Patrick McLean <chutzpah-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
Reported-by: Guang Cheng Li <liguangc-vtt25B2cwJLQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 fs/namei.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/namei.c b/fs/namei.c
index caa2805..5b10ad0 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -585,6 +585,9 @@ drop_root_mnt:
 
 static inline int d_revalidate(struct dentry *dentry, unsigned int flags)
 {
+	/* dentries that serve as mountpoints are always considered valid */
+	if (d_mountpoint(dentry))
+		return 1;
 	return dentry->d_op->d_revalidate(dentry, flags);
 }
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2013-11-05  1:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-05  1:16 Jeff Layton [this message]
     [not found] ` <1383614186-8039-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-11-05  2:39   ` [PATCH] [RFC] vfs: don't revalidate dentries that serve as mountpoints NeilBrown
2013-11-05 10:34     ` Jeff Layton
2013-11-05  3:00   ` Shirish Pargaonkar
     [not found]     ` <CADT32eJ_cqej0wnjKOZk1x0UtRqoNy201hFt8hQLLShjcbp3Dg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-11-05  8:28       ` Christoph Hellwig
2013-11-05 10:42     ` 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=1383614186-8039-1-git-send-email-jlayton@redhat.com \
    --to=jlayton-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=chutzpah-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org \
    --cc=liguangc-vtt25B2cwJLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.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).