diff options
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r-- | fs/nfs/inode.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 23feb9e3d8b0..c5f4e0567533 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -793,6 +793,12 @@ static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
793 | { | 793 | { |
794 | struct nfs_inode *nfsi = NFS_I(inode); | 794 | struct nfs_inode *nfsi = NFS_I(inode); |
795 | 795 | ||
796 | if ((fattr->valid & NFS_ATTR_WCC_V4) != 0 && | ||
797 | nfsi->change_attr == fattr->pre_change_attr) { | ||
798 | nfsi->change_attr = fattr->change_attr; | ||
799 | if (S_ISDIR(inode->i_mode)) | ||
800 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; | ||
801 | } | ||
796 | /* If we have atomic WCC data, we may update some attributes */ | 802 | /* If we have atomic WCC data, we may update some attributes */ |
797 | if ((fattr->valid & NFS_ATTR_WCC) != 0) { | 803 | if ((fattr->valid & NFS_ATTR_WCC) != 0) { |
798 | if (timespec_equal(&inode->i_ctime, &fattr->pre_ctime)) | 804 | if (timespec_equal(&inode->i_ctime, &fattr->pre_ctime)) |
@@ -923,6 +929,34 @@ out: | |||
923 | return status; | 929 | return status; |
924 | } | 930 | } |
925 | 931 | ||
932 | /** | ||
933 | * nfs_post_op_update_inode_force_wcc - try to update the inode attribute cache | ||
934 | * @inode - pointer to inode | ||
935 | * @fattr - updated attributes | ||
936 | * | ||
937 | * After an operation that has changed the inode metadata, mark the | ||
938 | * attribute cache as being invalid, then try to update it. Fake up | ||
939 | * weak cache consistency data, if none exist. | ||
940 | * | ||
941 | * This function is mainly designed to be used by the ->write_done() functions. | ||
942 | */ | ||
943 | int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr) | ||
944 | { | ||
945 | if ((fattr->valid & NFS_ATTR_FATTR_V4) != 0 && | ||
946 | (fattr->valid & NFS_ATTR_WCC_V4) == 0) { | ||
947 | fattr->pre_change_attr = NFS_I(inode)->change_attr; | ||
948 | fattr->valid |= NFS_ATTR_WCC_V4; | ||
949 | } | ||
950 | if ((fattr->valid & NFS_ATTR_FATTR) != 0 && | ||
951 | (fattr->valid & NFS_ATTR_WCC) == 0) { | ||
952 | memcpy(&fattr->pre_ctime, &inode->i_ctime, sizeof(fattr->pre_ctime)); | ||
953 | memcpy(&fattr->pre_mtime, &inode->i_mtime, sizeof(fattr->pre_mtime)); | ||
954 | fattr->pre_size = inode->i_size; | ||
955 | fattr->valid |= NFS_ATTR_WCC; | ||
956 | } | ||
957 | return nfs_post_op_update_inode(inode, fattr); | ||
958 | } | ||
959 | |||
926 | /* | 960 | /* |
927 | * Many nfs protocol calls return the new file attributes after | 961 | * Many nfs protocol calls return the new file attributes after |
928 | * an operation. Here we update the inode to reflect the state | 962 | * an operation. Here we update the inode to reflect the state |