diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-09-27 10:07:31 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-10-09 17:18:55 -0400 |
commit | 17cadc95372e28024be0874e67329c1862912c5d (patch) | |
tree | 0785ba140643d87c23e7bca67d1f2522214a0d12 | |
parent | e323ea46d95d7f8c789effd1194dfc120284dbbd (diff) |
NFS: Don't force a dcache revalidation if nfs_wcc_update_inode succeeds
The reason is that if the weak cache consistency update was successful,
then we know that our client must be the only one that changed the
directory, and we've already updated the dcache to reflect the change.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/inode.c | 11 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 7 | ||||
-rw-r--r-- | include/linux/nfs_fs.h | 4 |
3 files changed, 11 insertions, 11 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index f1f6639f52b5..7e73edc1751f 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -791,24 +791,18 @@ void nfs_end_data_update(struct inode *inode) | |||
791 | static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr) | 791 | static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr) |
792 | { | 792 | { |
793 | struct nfs_inode *nfsi = NFS_I(inode); | 793 | struct nfs_inode *nfsi = NFS_I(inode); |
794 | unsigned long now = jiffies; | ||
795 | 794 | ||
796 | /* If we have atomic WCC data, we may update some attributes */ | 795 | /* If we have atomic WCC data, we may update some attributes */ |
797 | if ((fattr->valid & NFS_ATTR_WCC) != 0) { | 796 | if ((fattr->valid & NFS_ATTR_WCC) != 0) { |
798 | if (timespec_equal(&inode->i_ctime, &fattr->pre_ctime)) { | 797 | if (timespec_equal(&inode->i_ctime, &fattr->pre_ctime)) |
799 | memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime)); | 798 | memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime)); |
800 | nfsi->cache_change_attribute = now; | ||
801 | } | ||
802 | if (timespec_equal(&inode->i_mtime, &fattr->pre_mtime)) { | 799 | if (timespec_equal(&inode->i_mtime, &fattr->pre_mtime)) { |
803 | memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime)); | 800 | memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime)); |
804 | if (S_ISDIR(inode->i_mode)) | 801 | if (S_ISDIR(inode->i_mode)) |
805 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; | 802 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; |
806 | nfsi->cache_change_attribute = now; | ||
807 | } | 803 | } |
808 | if (inode->i_size == fattr->pre_size && nfsi->npages == 0) { | 804 | if (inode->i_size == fattr->pre_size && nfsi->npages == 0) |
809 | inode->i_size = fattr->size; | 805 | inode->i_size = fattr->size; |
810 | nfsi->cache_change_attribute = now; | ||
811 | } | ||
812 | } | 806 | } |
813 | } | 807 | } |
814 | 808 | ||
@@ -919,6 +913,7 @@ int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
919 | if (unlikely((fattr->valid & NFS_ATTR_FATTR) == 0)) { | 913 | if (unlikely((fattr->valid & NFS_ATTR_FATTR) == 0)) { |
920 | spin_lock(&inode->i_lock); | 914 | spin_lock(&inode->i_lock); |
921 | nfsi->cache_validity |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE; | 915 | nfsi->cache_validity |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE; |
916 | nfsi->cache_change_attribute = jiffies; | ||
922 | spin_unlock(&inode->i_lock); | 917 | spin_unlock(&inode->i_lock); |
923 | goto out; | 918 | goto out; |
924 | } | 919 | } |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 0e366a31f63b..871c102d9bdf 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -208,9 +208,12 @@ static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo) | |||
208 | struct nfs_inode *nfsi = NFS_I(dir); | 208 | struct nfs_inode *nfsi = NFS_I(dir); |
209 | 209 | ||
210 | spin_lock(&dir->i_lock); | 210 | spin_lock(&dir->i_lock); |
211 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_DATA; | 211 | if (cinfo->after != nfsi->change_attr) { |
212 | if (cinfo->before == nfsi->change_attr && cinfo->atomic) | 212 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_DATA; |
213 | if (!cinfo->atomic || cinfo->before != nfsi->change_attr) | ||
214 | nfsi->cache_change_attribute = jiffies; | ||
213 | nfsi->change_attr = cinfo->after; | 215 | nfsi->change_attr = cinfo->after; |
216 | } | ||
214 | spin_unlock(&dir->i_lock); | 217 | spin_unlock(&dir->i_lock); |
215 | } | 218 | } |
216 | 219 | ||
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index f45161363be2..fd2c5c8158cf 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -235,8 +235,10 @@ static inline void nfs_mark_for_revalidate(struct inode *inode) | |||
235 | 235 | ||
236 | spin_lock(&inode->i_lock); | 236 | spin_lock(&inode->i_lock); |
237 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS; | 237 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS; |
238 | if (S_ISDIR(inode->i_mode)) | 238 | if (S_ISDIR(inode->i_mode)) { |
239 | nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_DATA; | 239 | nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_DATA; |
240 | nfsi->cache_change_attribute = jiffies; | ||
241 | } | ||
240 | spin_unlock(&inode->i_lock); | 242 | spin_unlock(&inode->i_lock); |
241 | } | 243 | } |
242 | 244 | ||