diff options
-rw-r--r-- | fs/nfsd/nfscache.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c index f8f060ffbf4f..6040da8830ff 100644 --- a/fs/nfsd/nfscache.c +++ b/fs/nfsd/nfscache.c | |||
@@ -224,13 +224,6 @@ hash_refile(struct svc_cacherep *rp) | |||
224 | hlist_add_head(&rp->c_hash, cache_hash + hash_32(rp->c_xid, maskbits)); | 224 | hlist_add_head(&rp->c_hash, cache_hash + hash_32(rp->c_xid, maskbits)); |
225 | } | 225 | } |
226 | 226 | ||
227 | static inline bool | ||
228 | nfsd_cache_entry_expired(struct svc_cacherep *rp) | ||
229 | { | ||
230 | return rp->c_state != RC_INPROG && | ||
231 | time_after(jiffies, rp->c_timestamp + RC_EXPIRE); | ||
232 | } | ||
233 | |||
234 | /* | 227 | /* |
235 | * Walk the LRU list and prune off entries that are older than RC_EXPIRE. | 228 | * Walk the LRU list and prune off entries that are older than RC_EXPIRE. |
236 | * Also prune the oldest ones when the total exceeds the max number of entries. | 229 | * Also prune the oldest ones when the total exceeds the max number of entries. |
@@ -242,8 +235,14 @@ prune_cache_entries(void) | |||
242 | long freed = 0; | 235 | long freed = 0; |
243 | 236 | ||
244 | list_for_each_entry_safe(rp, tmp, &lru_head, c_lru) { | 237 | list_for_each_entry_safe(rp, tmp, &lru_head, c_lru) { |
245 | if (!nfsd_cache_entry_expired(rp) && | 238 | /* |
246 | num_drc_entries <= max_drc_entries) | 239 | * Don't free entries attached to calls that are still |
240 | * in-progress, but do keep scanning the list. | ||
241 | */ | ||
242 | if (rp->c_state == RC_INPROG) | ||
243 | continue; | ||
244 | if (num_drc_entries <= max_drc_entries && | ||
245 | time_before(jiffies, rp->c_timestamp + RC_EXPIRE)) | ||
247 | break; | 246 | break; |
248 | nfsd_reply_cache_free_locked(rp); | 247 | nfsd_reply_cache_free_locked(rp); |
249 | freed++; | 248 | freed++; |