diff options
author | Jeff Layton <jlayton@redhat.com> | 2013-02-04 08:18:00 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2013-02-04 17:19:09 -0500 |
commit | 56c2548b2d24de440868885e4c36c985eca2d083 (patch) | |
tree | 704b148cdae6c4858decbaee07790357f2d75367 /fs/nfsd | |
parent | 2eeb9b2abc83a7fd02063c7558b8e729f5a3ae00 (diff) |
nfsd: always move DRC entries to the end of LRU list when updating timestamp
...otherwise, we end up with the list ordering wrong. Currently, it's
not a problem since we skip RC_INPROG entries, but keeping the ordering
strict will be necessary for a later patch that adds a cache cleaner.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfscache.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c index b89e7c8b10ce..9d80dfa7778e 100644 --- a/fs/nfsd/nfscache.c +++ b/fs/nfsd/nfscache.c | |||
@@ -129,6 +129,7 @@ void nfsd_reply_cache_shutdown(void) | |||
129 | static void | 129 | static void |
130 | lru_put_end(struct svc_cacherep *rp) | 130 | lru_put_end(struct svc_cacherep *rp) |
131 | { | 131 | { |
132 | rp->c_timestamp = jiffies; | ||
132 | list_move_tail(&rp->c_lru, &lru_head); | 133 | list_move_tail(&rp->c_lru, &lru_head); |
133 | } | 134 | } |
134 | 135 | ||
@@ -245,9 +246,9 @@ nfsd_cache_lookup(struct svc_rqst *rqstp) | |||
245 | rpc_set_port((struct sockaddr *)&rp->c_addr, rpc_get_port(svc_addr(rqstp))); | 246 | rpc_set_port((struct sockaddr *)&rp->c_addr, rpc_get_port(svc_addr(rqstp))); |
246 | rp->c_prot = proto; | 247 | rp->c_prot = proto; |
247 | rp->c_vers = vers; | 248 | rp->c_vers = vers; |
248 | rp->c_timestamp = jiffies; | ||
249 | 249 | ||
250 | hash_refile(rp); | 250 | hash_refile(rp); |
251 | lru_put_end(rp); | ||
251 | 252 | ||
252 | /* release any buffer */ | 253 | /* release any buffer */ |
253 | if (rp->c_type == RC_REPLBUFF) { | 254 | if (rp->c_type == RC_REPLBUFF) { |
@@ -262,7 +263,6 @@ nfsd_cache_lookup(struct svc_rqst *rqstp) | |||
262 | found_entry: | 263 | found_entry: |
263 | /* We found a matching entry which is either in progress or done. */ | 264 | /* We found a matching entry which is either in progress or done. */ |
264 | age = jiffies - rp->c_timestamp; | 265 | age = jiffies - rp->c_timestamp; |
265 | rp->c_timestamp = jiffies; | ||
266 | lru_put_end(rp); | 266 | lru_put_end(rp); |
267 | 267 | ||
268 | rtn = RC_DROPIT; | 268 | rtn = RC_DROPIT; |
@@ -354,7 +354,6 @@ nfsd_cache_update(struct svc_rqst *rqstp, int cachetype, __be32 *statp) | |||
354 | rp->c_secure = rqstp->rq_secure; | 354 | rp->c_secure = rqstp->rq_secure; |
355 | rp->c_type = cachetype; | 355 | rp->c_type = cachetype; |
356 | rp->c_state = RC_DONE; | 356 | rp->c_state = RC_DONE; |
357 | rp->c_timestamp = jiffies; | ||
358 | spin_unlock(&cache_lock); | 357 | spin_unlock(&cache_lock); |
359 | return; | 358 | return; |
360 | } | 359 | } |