basic modification from way back
[powerpc.git] / fs / nfs / dir.c
index d971547..3df4288 100644 (file)
@@ -38,7 +38,6 @@
 #include "delegation.h"
 #include "iostat.h"
 
-#define NFS_PARANOIA 1
 /* #define NFS_DEBUG_VERBOSE 1 */
 
 static int nfs_opendir(struct inode *, struct file *);
@@ -334,8 +333,6 @@ int find_dirent_page(nfs_readdir_descriptor_t *desc)
                status = PTR_ERR(page);
                goto out;
        }
-       if (!PageUptodate(page))
-               goto read_error;
 
        /* NOTE: Someone else may have changed the READDIRPLUS flag */
        desc->page = page;
@@ -349,9 +346,6 @@ int find_dirent_page(nfs_readdir_descriptor_t *desc)
  out:
        dfprintk(DIRCACHE, "NFS: %s: returns %d\n", __FUNCTION__, status);
        return status;
- read_error:
-       page_cache_release(page);
-       return -EIO;
 }
 
 /*
@@ -655,12 +649,15 @@ int nfs_fsync_dir(struct file *filp, struct dentry *dentry, int datasync)
  */
 static int nfs_check_verifier(struct inode *dir, struct dentry *dentry)
 {
+       unsigned long verf;
+
        if (IS_ROOT(dentry))
                return 1;
-       if ((NFS_I(dir)->cache_validity & NFS_INO_INVALID_ATTR) != 0
-                       || nfs_attribute_timeout(dir))
+       verf = (unsigned long)dentry->d_fsdata;
+       if (nfs_caches_unstable(dir)
+                       || verf != NFS_I(dir)->cache_change_attribute)
                return 0;
-       return nfs_verify_change_attribute(dir, (unsigned long)dentry->d_fsdata);
+       return 1;
 }
 
 static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf)
@@ -670,8 +667,7 @@ static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf)
 
 static void nfs_refresh_verifier(struct dentry * dentry, unsigned long verf)
 {
-       if (time_after(verf, (unsigned long)dentry->d_fsdata))
-               nfs_set_verifier(dentry, verf);
+       nfs_set_verifier(dentry, verf);
 }
 
 /*
@@ -770,6 +766,10 @@ static int nfs_lookup_revalidate(struct dentry * dentry, struct nameidata *nd)
        nfs_inc_stats(dir, NFSIOS_DENTRYREVALIDATE);
        inode = dentry->d_inode;
 
+       /* Revalidate parent directory attribute cache */
+       if (nfs_revalidate_inode(NFS_SERVER(dir), dir) < 0)
+               goto out_zap_parent;
+
        if (!inode) {
                if (nfs_neg_need_reval(dir, dentry, nd))
                        goto out_bad;
@@ -783,10 +783,6 @@ static int nfs_lookup_revalidate(struct dentry * dentry, struct nameidata *nd)
                goto out_bad;
        }
 
-       /* Revalidate parent directory attribute cache */
-       if (nfs_revalidate_inode(NFS_SERVER(dir), dir) < 0)
-               goto out_zap_parent;
-
        /* Force a full look up iff the parent directory has changed */
        if (nfs_check_verifier(dir, dentry)) {
                if (nfs_lookup_verify_inode(inode, nd))
@@ -865,6 +861,10 @@ static int nfs_dentry_delete(struct dentry *dentry)
 static void nfs_dentry_iput(struct dentry *dentry, struct inode *inode)
 {
        nfs_inode_return_delegation(inode);
+       if (S_ISDIR(inode->i_mode))
+               /* drop any readdir cache as it could easily be old */
+               NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA;
+
        if (dentry->d_flags & DCACHE_NFSFS_RENAMED) {
                lock_kernel();
                drop_nlink(inode);
@@ -1361,11 +1361,6 @@ static int nfs_sillyrename(struct inode *dir, struct dentry *dentry)
                atomic_read(&dentry->d_count));
        nfs_inc_stats(dir, NFSIOS_SILLYRENAME);
 
-#ifdef NFS_PARANOIA
-if (!dentry->d_inode)
-printk("NFS: silly-renaming %s/%s, negative dentry??\n",
-dentry->d_parent->d_name.name, dentry->d_name.name);
-#endif
        /*
         * We don't allow a dentry to be silly-renamed twice.
         */
@@ -1682,16 +1677,9 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
                        new_inode = NULL;
                        /* instantiate the replacement target */
                        d_instantiate(new_dentry, NULL);
-               } else if (atomic_read(&new_dentry->d_count) > 1) {
-               /* dentry still busy? */
-#ifdef NFS_PARANOIA
-                       printk("nfs_rename: target %s/%s busy, d_count=%d\n",
-                              new_dentry->d_parent->d_name.name,
-                              new_dentry->d_name.name,
-                              atomic_read(&new_dentry->d_count));
-#endif
+               } else if (atomic_read(&new_dentry->d_count) > 1)
+                       /* dentry still busy? */
                        goto out;
-               }
        } else
                drop_nlink(new_inode);