aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/cache.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-08-04 01:22:38 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-08-04 11:03:01 -0400
commit5c4d26390341732a8d614141a4cf4663610a1698 (patch)
tree1361af921aadc75c1a1fa1a23eb83292dcad8130 /net/sunrpc/cache.c
parentf866a8194f7cbabb9135b98b9ac7d26237b88367 (diff)
sunrpc/cache: make sure deferred requests eventually get revisited.
While deferred requests normally get revisited quite quickly, it is possible for a request to remain in the deferral queue when the cache item is discarded. We can easily make sure that doesn't happen by calling cache_revisit_request just before the final 'put'. Also there is a small chance that a race would cause one thread to defer a request against a cache item while another thread is failing to queue an upcall for that item. So when the upcall fails, make sure to revisit all deferred requests. 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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index d19c07583f8f..44f45166378a 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -221,6 +221,7 @@ int cache_check(struct cache_detail *detail,
221 switch (cache_make_upcall(detail, h)) { 221 switch (cache_make_upcall(detail, h)) {
222 case -EINVAL: 222 case -EINVAL:
223 clear_bit(CACHE_PENDING, &h->flags); 223 clear_bit(CACHE_PENDING, &h->flags);
224 cache_revisit_request(h);
224 if (rv == -EAGAIN) { 225 if (rv == -EAGAIN) {
225 set_bit(CACHE_NEGATIVE, &h->flags); 226 set_bit(CACHE_NEGATIVE, &h->flags);
226 cache_fresh_unlocked(h, detail, 227 cache_fresh_unlocked(h, detail,
@@ -473,8 +474,10 @@ static int cache_clean(void)
473 if (!ch) 474 if (!ch)
474 current_index ++; 475 current_index ++;
475 spin_unlock(&cache_list_lock); 476 spin_unlock(&cache_list_lock);
476 if (ch) 477 if (ch) {
478 cache_revisit_request(ch);
477 cache_put(ch, d); 479 cache_put(ch, d);
480 }
478 } else 481 } else
479 spin_unlock(&cache_list_lock); 482 spin_unlock(&cache_list_lock);
480 483