Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=47aabaa7e45385fee4a535a6f6e523ff944e1684
Commit:     47aabaa7e45385fee4a535a6f6e523ff944e1684
Parent:     17cadc95372e28024be0874e67329c1862912c5d
Author:     Trond Myklebust <[EMAIL PROTECTED]>
AuthorDate: Thu Sep 27 15:57:24 2007 -0400
Committer:  Trond Myklebust <[EMAIL PROTECTED]>
CommitDate: Tue Oct 9 17:18:57 2007 -0400

    NFSv4: Don't use ctime/mtime for determining when to invalidate the caches
    
    In NFSv4 we should only be looking at the change attribute.
    
    Signed-off-by: Trond Myklebust <[EMAIL PROTECTED]>
---
 fs/nfs/inode.c |   47 ++++++++++++++++++++++++-----------------------
 1 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 7e73edc..cd57f79 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -976,6 +976,27 @@ static int nfs_update_inode(struct inode *inode, struct 
nfs_fattr *fattr)
        /* Do atomic weak cache consistency updates */
        nfs_wcc_update_inode(inode, fattr);
 
+       /* More cache consistency checks */
+       if (!(fattr->valid & NFS_ATTR_FATTR_V4)) {
+               /* NFSv2/v3: Check if the mtime agrees */
+               if (!timespec_equal(&inode->i_mtime, &fattr->mtime)) {
+                       dprintk("NFS: mtime change on server for file %s/%ld\n",
+                                       inode->i_sb->s_id, inode->i_ino);
+                       invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA;
+                       nfsi->cache_change_attribute = now;
+               }
+               /* If ctime has changed we should definitely clear access+acl 
caches */
+               if (!timespec_equal(&inode->i_ctime, &fattr->ctime)) {
+                       invalid |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
+                       nfsi->cache_change_attribute = now;
+               }
+       } else if (nfsi->change_attr != fattr->change_attr) {
+               dprintk("NFS: change_attr change on server for file %s/%ld\n",
+                               inode->i_sb->s_id, inode->i_ino);
+               invalid |= 
NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
+               nfsi->cache_change_attribute = now;
+       }
+
        /* Check if our cached file size is stale */
        new_isize = nfs_size_to_loff_t(fattr->size);
        cur_isize = i_size_read(inode);
@@ -997,22 +1018,11 @@ static int nfs_update_inode(struct inode *inode, struct 
nfs_fattr *fattr)
                                inode->i_sb->s_id, inode->i_ino);
        }
 
-       /* Check if the mtime agrees */
-       if (!timespec_equal(&inode->i_mtime, &fattr->mtime)) {
-               memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime));
-               dprintk("NFS: mtime change on server for file %s/%ld\n",
-                               inode->i_sb->s_id, inode->i_ino);
-               invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA;
-               nfsi->cache_change_attribute = now;
-       }
 
-       /* If ctime has changed we should definitely clear access+acl caches */
-       if (!timespec_equal(&inode->i_ctime, &fattr->ctime)) {
-               invalid |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
-               memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime));
-               nfsi->cache_change_attribute = now;
-       }
+       memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime));
+       memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime));
        memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime));
+       nfsi->change_attr = fattr->change_attr;
 
        if ((inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO) ||
            inode->i_uid != fattr->uid ||
@@ -1033,15 +1043,6 @@ static int nfs_update_inode(struct inode *inode, struct 
nfs_fattr *fattr)
                inode->i_blocks = fattr->du.nfs2.blocks;
        }
 
-       if ((fattr->valid & NFS_ATTR_FATTR_V4) != 0 &&
-                       nfsi->change_attr != fattr->change_attr) {
-               dprintk("NFS: change_attr change on server for file %s/%ld\n",
-                               inode->i_sb->s_id, inode->i_ino);
-               nfsi->change_attr = fattr->change_attr;
-               invalid |= 
NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
-               nfsi->cache_change_attribute = now;
-       }
-
        /* Update attrtimeo value if we're out of the unstable period */
        if (invalid & NFS_INO_INVALID_ATTR) {
                nfs_inc_stats(inode, NFSIOS_ATTRINVALIDATE);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to