diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-10-01 18:57:50 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-10-09 17:19:55 -0400 |
commit | 6d2b2966869142660f46d1e06cf9d15c3debcf77 (patch) | |
tree | 21520382d3ca7ac3720bcf84dd76a1c3fb94331a /fs | |
parent | 60ccd4ec4170c9487e3792322626acd160197bce (diff) |
NFS: Reset nfsi->last_updated only if the attribute changed
Otherwise set it to nfsi->read_cache_jiffies in order to prevent jiffy
wraparound issues.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/inode.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 1c23d3a67c85..9d012a6ee4cc 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -956,7 +956,6 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
956 | * Update the read time so we don't revalidate too often. | 956 | * Update the read time so we don't revalidate too often. |
957 | */ | 957 | */ |
958 | nfsi->read_cache_jiffies = fattr->time_start; | 958 | nfsi->read_cache_jiffies = fattr->time_start; |
959 | nfsi->last_updated = now; | ||
960 | 959 | ||
961 | nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ATIME | 960 | nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ATIME |
962 | | NFS_INO_REVAL_PAGECACHE); | 961 | | NFS_INO_REVAL_PAGECACHE); |
@@ -1027,10 +1026,18 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1027 | nfs_inc_stats(inode, NFSIOS_ATTRINVALIDATE); | 1026 | nfs_inc_stats(inode, NFSIOS_ATTRINVALIDATE); |
1028 | nfsi->attrtimeo = NFS_MINATTRTIMEO(inode); | 1027 | nfsi->attrtimeo = NFS_MINATTRTIMEO(inode); |
1029 | nfsi->attrtimeo_timestamp = now; | 1028 | nfsi->attrtimeo_timestamp = now; |
1030 | } else if (!time_in_range(now, nfsi->attrtimeo_timestamp, nfsi->attrtimeo_timestamp + nfsi->attrtimeo)) { | 1029 | nfsi->last_updated = now; |
1031 | if ((nfsi->attrtimeo <<= 1) > NFS_MAXATTRTIMEO(inode)) | 1030 | } else { |
1032 | nfsi->attrtimeo = NFS_MAXATTRTIMEO(inode); | 1031 | if (!time_in_range(now, nfsi->attrtimeo_timestamp, nfsi->attrtimeo_timestamp + nfsi->attrtimeo)) { |
1033 | nfsi->attrtimeo_timestamp = now; | 1032 | if ((nfsi->attrtimeo <<= 1) > NFS_MAXATTRTIMEO(inode)) |
1033 | nfsi->attrtimeo = NFS_MAXATTRTIMEO(inode); | ||
1034 | nfsi->attrtimeo_timestamp = now; | ||
1035 | } | ||
1036 | /* | ||
1037 | * Avoid jiffy wraparound issues with nfsi->last_updated | ||
1038 | */ | ||
1039 | if (!time_in_range(nfsi->last_updated, nfsi->read_cache_jiffies, now)) | ||
1040 | nfsi->last_updated = nfsi->read_cache_jiffies; | ||
1034 | } | 1041 | } |
1035 | invalid &= ~NFS_INO_INVALID_ATTR; | 1042 | invalid &= ~NFS_INO_INVALID_ATTR; |
1036 | /* Don't invalidate the data if we were to blame */ | 1043 | /* Don't invalidate the data if we were to blame */ |