Commit 45bde054 authored by Trond Myklebust's avatar Trond Myklebust

[PATCH] Fix NFS attribute caching bug

  Fixes an obvious bug in __nfs_refresh_inode(): after updating the
attribute cache, if we discover that the data cache is invalid don't
call nfs_zap_caches() as that will also reinvalidate the attribute
cache.
  This bug plays havoc with the new lookup/revalidation code in 2.4.19
since it forces a lot of unnecessary extra GETATTR RPC calls.
parent 4b11b184
...@@ -1093,14 +1093,17 @@ __nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr) ...@@ -1093,14 +1093,17 @@ __nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr)
} }
/* Update attrtimeo value */ /* Update attrtimeo value */
if (!invalid && time_after(jiffies, NFS_ATTRTIMEO_UPDATE(inode)+NFS_ATTRTIMEO(inode))) { if (invalid) {
NFS_ATTRTIMEO(inode) = NFS_MINATTRTIMEO(inode);
NFS_ATTRTIMEO_UPDATE(inode) = jiffies;
invalidate_inode_pages(inode);
memset(NFS_COOKIEVERF(inode), 0, sizeof(NFS_COOKIEVERF(inode)));
} else if (time_after(jiffies, NFS_ATTRTIMEO_UPDATE(inode)+NFS_ATTRTIMEO(inode))) {
if ((NFS_ATTRTIMEO(inode) <<= 1) > NFS_MAXATTRTIMEO(inode)) if ((NFS_ATTRTIMEO(inode) <<= 1) > NFS_MAXATTRTIMEO(inode))
NFS_ATTRTIMEO(inode) = NFS_MAXATTRTIMEO(inode); NFS_ATTRTIMEO(inode) = NFS_MAXATTRTIMEO(inode);
NFS_ATTRTIMEO_UPDATE(inode) = jiffies; NFS_ATTRTIMEO_UPDATE(inode) = jiffies;
} }
if (invalid)
nfs_zap_caches(inode);
return 0; return 0;
out_nochange: out_nochange:
if (new_atime - inode->i_atime > 0) if (new_atime - inode->i_atime > 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment