diff options
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | 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 7e73edc1751f..cd57f795229e 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) | |||
976 | /* Do atomic weak cache consistency updates */ | 976 | /* Do atomic weak cache consistency updates */ |
977 | nfs_wcc_update_inode(inode, fattr); | 977 | nfs_wcc_update_inode(inode, fattr); |
978 | 978 | ||
979 | /* More cache consistency checks */ | ||
980 | if (!(fattr->valid & NFS_ATTR_FATTR_V4)) { | ||
981 | /* NFSv2/v3: Check if the mtime agrees */ | ||
982 | if (!timespec_equal(&inode->i_mtime, &fattr->mtime)) { | ||
983 | dprintk("NFS: mtime change on server for file %s/%ld\n", | ||
984 | inode->i_sb->s_id, inode->i_ino); | ||
985 | invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA; | ||
986 | nfsi->cache_change_attribute = now; | ||
987 | } | ||
988 | /* If ctime has changed we should definitely clear access+acl caches */ | ||
989 | if (!timespec_equal(&inode->i_ctime, &fattr->ctime)) { | ||
990 | invalid |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; | ||
991 | nfsi->cache_change_attribute = now; | ||
992 | } | ||
993 | } else if (nfsi->change_attr != fattr->change_attr) { | ||
994 | dprintk("NFS: change_attr change on server for file %s/%ld\n", | ||
995 | inode->i_sb->s_id, inode->i_ino); | ||
996 | invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; | ||
997 | nfsi->cache_change_attribute = now; | ||
998 | } | ||
999 | |||
979 | /* Check if our cached file size is stale */ | 1000 | /* Check if our cached file size is stale */ |
980 | new_isize = nfs_size_to_loff_t(fattr->size); | 1001 | new_isize = nfs_size_to_loff_t(fattr->size); |
981 | cur_isize = i_size_read(inode); | 1002 | cur_isize = i_size_read(inode); |
@@ -997,22 +1018,11 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
997 | inode->i_sb->s_id, inode->i_ino); | 1018 | inode->i_sb->s_id, inode->i_ino); |
998 | } | 1019 | } |
999 | 1020 | ||
1000 | /* Check if the mtime agrees */ | ||
1001 | if (!timespec_equal(&inode->i_mtime, &fattr->mtime)) { | ||
1002 | memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime)); | ||
1003 | dprintk("NFS: mtime change on server for file %s/%ld\n", | ||
1004 | inode->i_sb->s_id, inode->i_ino); | ||
1005 | invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA; | ||
1006 | nfsi->cache_change_attribute = now; | ||
1007 | } | ||
1008 | 1021 | ||
1009 | /* If ctime has changed we should definitely clear access+acl caches */ | 1022 | memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime)); |
1010 | if (!timespec_equal(&inode->i_ctime, &fattr->ctime)) { | 1023 | memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime)); |
1011 | invalid |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; | ||
1012 | memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime)); | ||
1013 | nfsi->cache_change_attribute = now; | ||
1014 | } | ||
1015 | memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime)); | 1024 | memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime)); |
1025 | nfsi->change_attr = fattr->change_attr; | ||
1016 | 1026 | ||
1017 | if ((inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO) || | 1027 | if ((inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO) || |
1018 | inode->i_uid != fattr->uid || | 1028 | inode->i_uid != fattr->uid || |
@@ -1033,15 +1043,6 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1033 | inode->i_blocks = fattr->du.nfs2.blocks; | 1043 | inode->i_blocks = fattr->du.nfs2.blocks; |
1034 | } | 1044 | } |
1035 | 1045 | ||
1036 | if ((fattr->valid & NFS_ATTR_FATTR_V4) != 0 && | ||
1037 | nfsi->change_attr != fattr->change_attr) { | ||
1038 | dprintk("NFS: change_attr change on server for file %s/%ld\n", | ||
1039 | inode->i_sb->s_id, inode->i_ino); | ||
1040 | nfsi->change_attr = fattr->change_attr; | ||
1041 | invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; | ||
1042 | nfsi->cache_change_attribute = now; | ||
1043 | } | ||
1044 | |||
1045 | /* Update attrtimeo value if we're out of the unstable period */ | 1046 | /* Update attrtimeo value if we're out of the unstable period */ |
1046 | if (invalid & NFS_INO_INVALID_ATTR) { | 1047 | if (invalid & NFS_INO_INVALID_ATTR) { |
1047 | nfs_inc_stats(inode, NFSIOS_ATTRINVALIDATE); | 1048 | nfs_inc_stats(inode, NFSIOS_ATTRINVALIDATE); |