diff options
author | Jeff Layton <jlayton@redhat.com> | 2013-02-20 11:19:05 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-26 02:46:09 -0500 |
commit | ecf3d1f1aa74da0d632b651a2e05a911f60e92c0 (patch) | |
tree | 62a2e0a46bfd993a24a1154ec1331c57bbd50482 /fs/dcache.c | |
parent | 4f4a4faddea0fe45bf508e723c3a810c5190ed62 (diff) |
vfs: kill FS_REVAL_DOT by adding a d_weak_revalidate dentry op
The following set of operations on a NFS client and server will cause
server# mkdir a
client# cd a
server# mv a a.bak
client# sleep 30 # (or whatever the dir attrcache timeout is)
client# stat .
stat: cannot stat `.': Stale NFS file handle
Obviously, we should not be getting an ESTALE error back there since the
inode still exists on the server. The problem is that the lookup code
will call d_revalidate on the dentry that "." refers to, because NFS has
FS_REVAL_DOT set.
nfs_lookup_revalidate will see that the parent directory has changed and
will try to reverify the dentry by redoing a LOOKUP. That of course
fails, so the lookup code returns ESTALE.
The problem here is that d_revalidate is really a bad fit for this case.
What we really want to know at this point is whether the inode is still
good or not, but we don't really care what name it goes by or whether
the dcache is still valid.
Add a new d_op->d_weak_revalidate operation and have complete_walk call
that instead of d_revalidate. The intent there is to allow for a
"weaker" d_revalidate that just checks to see whether the inode is still
good. This is also gives us an opportunity to kill off the FS_REVAL_DOT
special casing.
[AV: changed method name, added note in porting, fixed confusion re
having it possibly called from RCU mode (it won't be)]
Cc: NeilBrown <neilb@suse.de>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index ebab049826c0..68220dd0c135 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -1358,6 +1358,7 @@ void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op) | |||
1358 | WARN_ON_ONCE(dentry->d_flags & (DCACHE_OP_HASH | | 1358 | WARN_ON_ONCE(dentry->d_flags & (DCACHE_OP_HASH | |
1359 | DCACHE_OP_COMPARE | | 1359 | DCACHE_OP_COMPARE | |
1360 | DCACHE_OP_REVALIDATE | | 1360 | DCACHE_OP_REVALIDATE | |
1361 | DCACHE_OP_WEAK_REVALIDATE | | ||
1361 | DCACHE_OP_DELETE )); | 1362 | DCACHE_OP_DELETE )); |
1362 | dentry->d_op = op; | 1363 | dentry->d_op = op; |
1363 | if (!op) | 1364 | if (!op) |
@@ -1368,6 +1369,8 @@ void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op) | |||
1368 | dentry->d_flags |= DCACHE_OP_COMPARE; | 1369 | dentry->d_flags |= DCACHE_OP_COMPARE; |
1369 | if (op->d_revalidate) | 1370 | if (op->d_revalidate) |
1370 | dentry->d_flags |= DCACHE_OP_REVALIDATE; | 1371 | dentry->d_flags |= DCACHE_OP_REVALIDATE; |
1372 | if (op->d_weak_revalidate) | ||
1373 | dentry->d_flags |= DCACHE_OP_WEAK_REVALIDATE; | ||
1371 | if (op->d_delete) | 1374 | if (op->d_delete) |
1372 | dentry->d_flags |= DCACHE_OP_DELETE; | 1375 | dentry->d_flags |= DCACHE_OP_DELETE; |
1373 | if (op->d_prune) | 1376 | if (op->d_prune) |