aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2013-02-20 11:19:05 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-26 02:46:09 -0500
commitecf3d1f1aa74da0d632b651a2e05a911f60e92c0 (patch)
tree62a2e0a46bfd993a24a1154ec1331c57bbd50482 /include/linux
parent4f4a4faddea0fe45bf508e723c3a810c5190ed62 (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 'include/linux')
-rw-r--r--include/linux/dcache.h3
-rw-r--r--include/linux/fs.h1
2 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 03d169288423..1a6bb81f0fe5 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -145,6 +145,7 @@ enum dentry_d_lock_class
145 145
146struct dentry_operations { 146struct dentry_operations {
147 int (*d_revalidate)(struct dentry *, unsigned int); 147 int (*d_revalidate)(struct dentry *, unsigned int);
148 int (*d_weak_revalidate)(struct dentry *, unsigned int);
148 int (*d_hash)(const struct dentry *, const struct inode *, 149 int (*d_hash)(const struct dentry *, const struct inode *,
149 struct qstr *); 150 struct qstr *);
150 int (*d_compare)(const struct dentry *, const struct inode *, 151 int (*d_compare)(const struct dentry *, const struct inode *,
@@ -192,6 +193,8 @@ struct dentry_operations {
192#define DCACHE_GENOCIDE 0x0200 193#define DCACHE_GENOCIDE 0x0200
193#define DCACHE_SHRINK_LIST 0x0400 194#define DCACHE_SHRINK_LIST 0x0400
194 195
196#define DCACHE_OP_WEAK_REVALIDATE 0x0800
197
195#define DCACHE_NFSFS_RENAMED 0x1000 198#define DCACHE_NFSFS_RENAMED 0x1000
196 /* this dentry has been "silly renamed" and has to be deleted on the last 199 /* this dentry has been "silly renamed" and has to be deleted on the last
197 * dput() */ 200 * dput() */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7f471520b88b..da94011ae83c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1807,7 +1807,6 @@ struct file_system_type {
1807#define FS_HAS_SUBTYPE 4 1807#define FS_HAS_SUBTYPE 4
1808#define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */ 1808#define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */
1809#define FS_USERNS_DEV_MOUNT 16 /* A userns mount does not imply MNT_NODEV */ 1809#define FS_USERNS_DEV_MOUNT 16 /* A userns mount does not imply MNT_NODEV */
1810#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */
1811#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ 1810#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */
1812 struct dentry *(*mount) (struct file_system_type *, int, 1811 struct dentry *(*mount) (struct file_system_type *, int,
1813 const char *, void *); 1812 const char *, void *);