diff options
author | NeilBrown <neilb@suse.de> | 2010-02-03 01:31:31 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2010-03-14 18:03:54 -0400 |
commit | 3af4974eb2c7867d6e160977195dfde586d0e564 (patch) | |
tree | ec9f0bcadbeab55ccc3a0bf8cf512ebf80c72e9a /net/sunrpc/cache.c | |
parent | e739cf1da48e841bc5d744a99764c1a668b4bdd2 (diff) |
sunrpc: don't keep expired entries in the auth caches.
currently expired entries remain in the auth caches as long
as there is a reference.
This was needed long ago when the auth_domain cache used the same
cache infrastructure. But since that (being a very different sort
of cache) was separated, this test is no longer needed.
So remove the test on refcnt and tidy up the surrounding code.
This allows the cache_dequeue call (which needed to be there to
drop a potentially awkward reference) can be moved outside of the
spinlock which is a better place for it.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'net/sunrpc/cache.c')
-rw-r--r-- | net/sunrpc/cache.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 39bddba53ba1..83592e012585 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -397,31 +397,28 @@ static int cache_clean(void) | |||
397 | /* Ok, now to clean this strand */ | 397 | /* Ok, now to clean this strand */ |
398 | 398 | ||
399 | cp = & current_detail->hash_table[current_index]; | 399 | cp = & current_detail->hash_table[current_index]; |
400 | ch = *cp; | 400 | for (ch = *cp ; ch ; cp = & ch->next, ch = *cp) { |
401 | for (; ch; cp= & ch->next, ch= *cp) { | ||
402 | if (current_detail->nextcheck > ch->expiry_time) | 401 | if (current_detail->nextcheck > ch->expiry_time) |
403 | current_detail->nextcheck = ch->expiry_time+1; | 402 | current_detail->nextcheck = ch->expiry_time+1; |
404 | if (ch->expiry_time >= get_seconds() && | 403 | if (ch->expiry_time >= get_seconds() && |
405 | ch->last_refresh >= current_detail->flush_time) | 404 | ch->last_refresh >= current_detail->flush_time) |
406 | continue; | 405 | continue; |
407 | if (test_and_clear_bit(CACHE_PENDING, &ch->flags)) | ||
408 | cache_dequeue(current_detail, ch); | ||
409 | 406 | ||
410 | if (atomic_read(&ch->ref.refcount) == 1) | ||
411 | break; | ||
412 | } | ||
413 | if (ch) { | ||
414 | *cp = ch->next; | 407 | *cp = ch->next; |
415 | ch->next = NULL; | 408 | ch->next = NULL; |
416 | current_detail->entries--; | 409 | current_detail->entries--; |
417 | rv = 1; | 410 | rv = 1; |
411 | break; | ||
418 | } | 412 | } |
413 | |||
419 | write_unlock(¤t_detail->hash_lock); | 414 | write_unlock(¤t_detail->hash_lock); |
420 | d = current_detail; | 415 | d = current_detail; |
421 | if (!ch) | 416 | if (!ch) |
422 | current_index ++; | 417 | current_index ++; |
423 | spin_unlock(&cache_list_lock); | 418 | spin_unlock(&cache_list_lock); |
424 | if (ch) { | 419 | if (ch) { |
420 | if (test_and_clear_bit(CACHE_PENDING, &ch->flags)) | ||
421 | cache_dequeue(current_detail, ch); | ||
425 | cache_revisit_request(ch); | 422 | cache_revisit_request(ch); |
426 | cache_put(ch, d); | 423 | cache_put(ch, d); |
427 | } | 424 | } |