diff options
| -rw-r--r-- | fs/nfs/dir.c | 14 | ||||
| -rw-r--r-- | fs/nfs/inode.c | 1 | ||||
| -rw-r--r-- | fs/nfs/write.c | 1 |
3 files changed, 13 insertions, 3 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index b39a0468829b..be38b573495a 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
| @@ -274,6 +274,15 @@ out_eof: | |||
| 274 | return -EBADCOOKIE; | 274 | return -EBADCOOKIE; |
| 275 | } | 275 | } |
| 276 | 276 | ||
| 277 | static bool | ||
| 278 | nfs_readdir_inode_mapping_valid(struct nfs_inode *nfsi) | ||
| 279 | { | ||
| 280 | if (nfsi->cache_validity & (NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA)) | ||
| 281 | return false; | ||
| 282 | smp_rmb(); | ||
| 283 | return !test_bit(NFS_INO_INVALIDATING, &nfsi->flags); | ||
| 284 | } | ||
| 285 | |||
| 277 | static | 286 | static |
| 278 | int nfs_readdir_search_for_cookie(struct nfs_cache_array *array, nfs_readdir_descriptor_t *desc) | 287 | int nfs_readdir_search_for_cookie(struct nfs_cache_array *array, nfs_readdir_descriptor_t *desc) |
| 279 | { | 288 | { |
| @@ -287,9 +296,8 @@ int nfs_readdir_search_for_cookie(struct nfs_cache_array *array, nfs_readdir_des | |||
| 287 | struct nfs_open_dir_context *ctx = desc->file->private_data; | 296 | struct nfs_open_dir_context *ctx = desc->file->private_data; |
| 288 | 297 | ||
| 289 | new_pos = desc->current_index + i; | 298 | new_pos = desc->current_index + i; |
| 290 | if (ctx->attr_gencount != nfsi->attr_gencount | 299 | if (ctx->attr_gencount != nfsi->attr_gencount || |
| 291 | || (nfsi->cache_validity & (NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA)) | 300 | !nfs_readdir_inode_mapping_valid(nfsi)) { |
| 292 | || test_bit(NFS_INO_INVALIDATING, &nfsi->flags)) { | ||
| 293 | ctx->duped = 0; | 301 | ctx->duped = 0; |
| 294 | ctx->attr_gencount = nfsi->attr_gencount; | 302 | ctx->attr_gencount = nfsi->attr_gencount; |
| 295 | } else if (new_pos < desc->ctx->pos) { | 303 | } else if (new_pos < desc->ctx->pos) { |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index e5070aa5f175..02e185168602 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
| @@ -1050,6 +1050,7 @@ int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) | |||
| 1050 | } | 1050 | } |
| 1051 | 1051 | ||
| 1052 | set_bit(NFS_INO_INVALIDATING, bitlock); | 1052 | set_bit(NFS_INO_INVALIDATING, bitlock); |
| 1053 | smp_wmb(); | ||
| 1053 | nfsi->cache_validity &= ~NFS_INO_INVALID_DATA; | 1054 | nfsi->cache_validity &= ~NFS_INO_INVALID_DATA; |
| 1054 | spin_unlock(&inode->i_lock); | 1055 | spin_unlock(&inode->i_lock); |
| 1055 | trace_nfs_invalidate_mapping_enter(inode); | 1056 | trace_nfs_invalidate_mapping_enter(inode); |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 5511a4247190..9a3b6a4cd6b9 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
| @@ -915,6 +915,7 @@ static bool nfs_write_pageuptodate(struct page *page, struct inode *inode) | |||
| 915 | goto out; | 915 | goto out; |
| 916 | if (nfsi->cache_validity & (NFS_INO_INVALID_DATA|NFS_INO_REVAL_PAGECACHE)) | 916 | if (nfsi->cache_validity & (NFS_INO_INVALID_DATA|NFS_INO_REVAL_PAGECACHE)) |
| 917 | return false; | 917 | return false; |
| 918 | smp_rmb(); | ||
| 918 | if (test_bit(NFS_INO_INVALIDATING, &nfsi->flags)) | 919 | if (test_bit(NFS_INO_INVALIDATING, &nfsi->flags)) |
| 919 | return false; | 920 | return false; |
| 920 | out: | 921 | out: |
