diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-05-25 01:40:55 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-06-09 09:34:08 -0400 |
commit | f1bb0b92ba2cdfffe6e437f7a7da53138cf08d52 (patch) | |
tree | 2870bd8f3e08b3b1b387f31713d965c3fcb7863f /fs | |
parent | 0d0b5cb36faf7002a11736032313f06d6f3d881c (diff) |
NFS: Fix page cache revalidation
Fix up a bug in the handling of NFS_INO_REVAL_PAGECACHE: make sure that
nfs_update_inode() clears it when we're sure we're not racing with other
updates.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/inode.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 4f12c57456f4..eddd0e982d23 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -1406,18 +1406,12 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat | |||
1406 | nfs_wcc_update_inode(inode, fattr); | 1406 | nfs_wcc_update_inode(inode, fattr); |
1407 | 1407 | ||
1408 | if ((fattr->valid & NFS_ATTR_FATTR_V4) != 0 && | 1408 | if ((fattr->valid & NFS_ATTR_FATTR_V4) != 0 && |
1409 | nfsi->change_attr != fattr->change_attr) { | 1409 | nfsi->change_attr != fattr->change_attr) |
1410 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | 1410 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE; |
1411 | if (!data_unstable) | ||
1412 | nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE; | ||
1413 | } | ||
1414 | 1411 | ||
1415 | /* Verify a few of the more important attributes */ | 1412 | /* Verify a few of the more important attributes */ |
1416 | if (!timespec_equal(&inode->i_mtime, &fattr->mtime)) { | 1413 | if (!timespec_equal(&inode->i_mtime, &fattr->mtime)) |
1417 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | 1414 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE; |
1418 | if (!data_unstable) | ||
1419 | nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE; | ||
1420 | } | ||
1421 | 1415 | ||
1422 | cur_size = i_size_read(inode); | 1416 | cur_size = i_size_read(inode); |
1423 | new_isize = nfs_size_to_loff_t(fattr->size); | 1417 | new_isize = nfs_size_to_loff_t(fattr->size); |
@@ -1459,7 +1453,6 @@ int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1459 | if ((fattr->valid & NFS_ATTR_FATTR) == 0) | 1453 | if ((fattr->valid & NFS_ATTR_FATTR) == 0) |
1460 | return 0; | 1454 | return 0; |
1461 | spin_lock(&inode->i_lock); | 1455 | spin_lock(&inode->i_lock); |
1462 | nfsi->cache_validity &= ~NFS_INO_REVAL_PAGECACHE; | ||
1463 | if (time_after(fattr->time_start, nfsi->last_updated)) | 1456 | if (time_after(fattr->time_start, nfsi->last_updated)) |
1464 | status = nfs_update_inode(inode, fattr); | 1457 | status = nfs_update_inode(inode, fattr); |
1465 | else | 1458 | else |
@@ -1484,7 +1477,7 @@ int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1484 | 1477 | ||
1485 | spin_lock(&inode->i_lock); | 1478 | spin_lock(&inode->i_lock); |
1486 | if (unlikely((fattr->valid & NFS_ATTR_FATTR) == 0)) { | 1479 | if (unlikely((fattr->valid & NFS_ATTR_FATTR) == 0)) { |
1487 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS; | 1480 | nfsi->cache_validity |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE; |
1488 | goto out; | 1481 | goto out; |
1489 | } | 1482 | } |
1490 | status = nfs_update_inode(inode, fattr); | 1483 | status = nfs_update_inode(inode, fattr); |
@@ -1534,7 +1527,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1534 | /* Are we racing with known updates of the metadata on the server? */ | 1527 | /* Are we racing with known updates of the metadata on the server? */ |
1535 | data_stable = nfs_verify_change_attribute(inode, fattr->time_start); | 1528 | data_stable = nfs_verify_change_attribute(inode, fattr->time_start); |
1536 | if (data_stable) | 1529 | if (data_stable) |
1537 | nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ATIME); | 1530 | nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE|NFS_INO_INVALID_ATIME); |
1538 | 1531 | ||
1539 | /* Do atomic weak cache consistency updates */ | 1532 | /* Do atomic weak cache consistency updates */ |
1540 | nfs_wcc_update_inode(inode, fattr); | 1533 | nfs_wcc_update_inode(inode, fattr); |