From: Jan Harkes <jaharkes@cs.cmu.edu>
To: linux-fsdevel@vger.kernel.org
Cc: Marcelo Tosatti <marcelo@conectiva.com.br>,
alan@lxorguk.ukuu.org.uk, Alexander Viro <viro@math.psu.edu>,
Trond Myklebust <trond.myklebust@fys.uio.no>
Subject: Re: [PATCH 2.4.19pre8][RFC] remove-NFS-close-to-open from VFS (was Re: [PATCHSET] 2.4.19-pre8-jp12)
Date: Thu, 17 Oct 2002 16:38:04 -0400 [thread overview]
Message-ID: <20021017203804.GA24523@ravel.coda.cs.cmu.edu> (raw)
In-Reply-To: <20020517034357.GA18449@ravel.coda.cs.cmu.edu> <E178TUb-0005Bh-00@the-village.bc.nu> <200205162142.AWF00051@netmail.netcologne.de>
Hi,
I'm pulling up this old thread again, because there are some serious
issues with a patch that was merged in 2.4.19-pre3.
Basically it boils down to this, NFS had problems with '.' and '..'
lookups as they were bypassing the dcache revalidation/lookup. However,
the patch that got merged in 2.4.19-pre3 to fix this is causing some
significant problems, it changed the semantics of d_revalidate.
Originally, returning a error from d_revalidate in cached_lookup would
force a subsequent real_lookup. After the patch, returning an error from
d_revalidate propagates (in some cases) ESTALE back up to userspace.
NFS seems to do it's own replacement for real_lookup in dentry_revalidate,
but most other filesystems (like Samba) 'fixed' the problem by simply
revalidating the cached attributes of the object with the server. This
ofcourse breaks when an object is simply renamed, as the revalidation
will reinstantiate the old and incorrect lookup path for the object in
the dcache.
Now either every filesystem will have to follow NFS's lead and
implement some form of real_lookup inside of the dentry_revalidate
function which is not the prettiest solution. Or the VFS patch should be
reverted/fixed to actually walk the tree for '.' and '..' lookups.
btw. the patch also leaks dentries when a 'stale dentry' happens to have
children because it doesn't properly check and handle the d_invalidate
returncode.
Jan
For reference here is the thread from last May when Joerg Prante tracked
down his problems in supermount to the NFS patch.
http://marc.theaimsgroup.com/?l=linux-kernel&m=102158542315351&w=2
Here is the 'controversial patch', cut-n-pasted out from linux.bkbits.net.
--- 1.19/fs/namei.c Thu Feb 28 05:57:29 2002
+++ 1.20/fs/namei.c Tue Mar 12 07:35:02 2002
@@ -457,7 +457,7 @@
while (*name=='/')
name++;
if (!*name)
- goto return_base;
+ goto return_reval;
inode = nd->dentry->d_inode;
if (current->link_count)
@@ -576,7 +576,7 @@
inode = nd->dentry->d_inode;
/* fallthrough */
case 1:
- goto return_base;
+ goto return_reval;
}
if (nd->dentry->d_op && nd->dentry->d_op->d_hash) {
err = nd->dentry->d_op->d_hash(nd->dentry, &this);
@@ -627,6 +627,19 @@
nd->last_type = LAST_DOT;
else if (this.len == 2 && this.name[1] == '.')
nd->last_type = LAST_DOTDOT;
+return_reval:
+ /*
+ * We bypassed the ordinary revalidation routines.
+ * Check the cached dentry for staleness.
+ */
+ dentry = nd->dentry;
+ if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
+ err = -ESTALE;
+ if (!dentry->d_op->d_revalidate(dentry, 0)) {
+ d_invalidate(dentry);
+ break;
+ }
+ }
return_base:
return 0;
out_dput:
next parent reply other threads:[~2002-10-17 20:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200205162142.AWF00051@netmail.netcologne.de>
[not found] ` <E178TUb-0005Bh-00@the-village.bc.nu>
[not found] ` <20020517034357.GA18449@ravel.coda.cs.cmu.edu>
[not found] ` <Pine.LNX.4.44.0205161105520.5254-100000@alumno.inacap.cl>
2002-10-17 20:38 ` Jan Harkes [this message]
2002-10-17 21:48 ` [PATCH 2.4.19pre8][RFC] remove-NFS-close-to-open from VFS (was Re: [PATCHSET] 2.4.19-pre8-jp12) Trond Myklebust
2002-10-17 22:16 ` Jan Harkes
2002-10-17 23:57 ` Trond Myklebust
2002-10-18 16:49 ` Jan Harkes
2002-10-18 17:03 ` Trond Myklebust
2002-10-18 17:12 ` Jan Harkes
2002-10-18 17:41 ` Trond Myklebust
2002-10-18 18:23 ` Jan Harkes
2002-10-18 19:23 ` Trond Myklebust
2002-10-21 17:07 ` Jan Harkes
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=20021017203804.GA24523@ravel.coda.cs.cmu.edu \
--to=jaharkes@cs.cmu.edu \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-fsdevel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
--cc=trond.myklebust@fys.uio.no \
--cc=viro@math.psu.edu \
/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).