NFS: Don't use readdirplus data if the page cache is invalid
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Sun, 30 Sep 2007 22:01:13 +0000 (18:01 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Tue, 9 Oct 2007 21:19:00 +0000 (17:19 -0400)
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/dir.c

index 6518b098e625a5872b7417f79ebfb4cd0016d955..9f8ec3c3e6a7787a1fa7cab3d308a93bede677db 100644 (file)
@@ -1110,6 +1110,7 @@ static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc)
                .len = entry->len,
        };
        struct inode *inode;
+       unsigned long verf = nfs_save_change_attribute(dir);
 
        switch (name.len) {
                case 2:
@@ -1120,6 +1121,14 @@ static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc)
                        if (name.name[0] == '.')
                                return dget(parent);
        }
+
+       spin_lock(&dir->i_lock);
+       if (NFS_I(dir)->cache_validity & NFS_INO_INVALID_DATA) {
+               spin_unlock(&dir->i_lock);
+               return NULL;
+       }
+       spin_unlock(&dir->i_lock);
+
        name.hash = full_name_hash(name.name, name.len);
        dentry = d_lookup(parent, &name);
        if (dentry != NULL) {
@@ -1161,7 +1170,7 @@ static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc)
        }
 
 out_renew:
-       nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
+       nfs_set_verifier(dentry, verf);
        return dentry;
 }
 
This page took 0.026875 seconds and 5 git commands to generate.