From: Trond Myklebust <trond.myklebust@primarydata.com>
To: linux-nfs@vger.kernel.org
Cc: Nix <nix@esperi.org.uk>, Neil Brown <neilb@suse.de>
Subject: [PATCH 1/3] NFS: Don't invalidate a submounted dentry in nfs_prime_dcache()
Date: Mon, 23 Feb 2015 19:14:55 -0500 [thread overview]
Message-ID: <1424736897-95767-1-git-send-email-trond.myklebust@primarydata.com> (raw)
If we're traversing a directory which contains a submounted filesystem,
or one that has a referral, the NFS server that is processing the READDIR
request will often return information for the underlying (mounted-on)
directory. It may, or may not, also return filehandle information.
If this happens, and the lookup in nfs_prime_dcache() returns the
dentry for the submounted directory, the filehandle comparison will
fail, and we call d_invalidate(). Post-commit 8ed936b5671bf
("vfs: Lazily remove mounts on unlinked files and directories."), this
means the entire subtree is unmounted.
The following minimal patch addresses this problem by punting on
the invalidation if there is a submount.
Kudos to Neil Brown <neilb@suse.de> for having tracked down this
issue (see link).
Reported-by: Nix <nix@esperi.org.uk>
Link: http://lkml.kernel.org/r/87iofju9ht.fsf@spindle.srvr.nix
Cc: stable@vger.kernel.org # 3.18+
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
---
fs/nfs/dir.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 9b0c55cb2a2e..0da617a61c0b 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -479,6 +479,10 @@ void nfs_prime_dcache(struct dentry *parent, struct nfs_entry *entry)
dentry = d_lookup(parent, &filename);
if (dentry != NULL) {
+ /* Is there a mountpoint here? If so, just exit */
+ if (!nfs_fsid_equal(&NFS_SB(dentry->d_sb)->fsid,
+ &entry->fattr->fsid))
+ goto out;
if (nfs_same_file(dentry, entry)) {
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
status = nfs_refresh_inode(dentry->d_inode, entry->fattr);
--
2.1.0
next reply other threads:[~2015-02-24 0:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-24 0:14 Trond Myklebust [this message]
2015-02-24 0:14 ` [PATCH 2/3] NFSv3: Use the readdir fileid as the mounted-on-fileid Trond Myklebust
2015-02-24 0:14 ` [PATCH 3/3] NFS: Don't require a filehandle to refresh the inode in nfs_prime_dcache() Trond Myklebust
2015-02-24 21:53 ` NeilBrown
2015-02-24 21:46 ` [PATCH 2/3] NFSv3: Use the readdir fileid as the mounted-on-fileid NeilBrown
2015-02-24 3:09 ` [PATCH 1/3] NFS: Don't invalidate a submounted dentry in nfs_prime_dcache() Trond Myklebust
2015-02-24 21:49 ` NeilBrown
2015-02-25 0:17 ` Trond Myklebust
2015-02-24 21:44 ` NeilBrown
2015-03-12 23:15 ` Nix
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=1424736897-95767-1-git-send-email-trond.myklebust@primarydata.com \
--to=trond.myklebust@primarydata.com \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=nix@esperi.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