diff options
-rw-r--r-- | net/sunrpc/cache.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 8e964ae8d7b5..29c463396a2d 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -228,15 +228,14 @@ static int try_to_negate_entry(struct cache_detail *detail, struct cache_head *h | |||
228 | 228 | ||
229 | write_lock(&detail->hash_lock); | 229 | write_lock(&detail->hash_lock); |
230 | rv = cache_is_valid(h); | 230 | rv = cache_is_valid(h); |
231 | if (rv != -EAGAIN) { | 231 | if (rv == -EAGAIN) { |
232 | write_unlock(&detail->hash_lock); | 232 | set_bit(CACHE_NEGATIVE, &h->flags); |
233 | return rv; | 233 | cache_fresh_locked(h, seconds_since_boot()+CACHE_NEW_EXPIRY); |
234 | rv = -ENOENT; | ||
234 | } | 235 | } |
235 | set_bit(CACHE_NEGATIVE, &h->flags); | ||
236 | cache_fresh_locked(h, seconds_since_boot()+CACHE_NEW_EXPIRY); | ||
237 | write_unlock(&detail->hash_lock); | 236 | write_unlock(&detail->hash_lock); |
238 | cache_fresh_unlocked(h, detail); | 237 | cache_fresh_unlocked(h, detail); |
239 | return -ENOENT; | 238 | return rv; |
240 | } | 239 | } |
241 | 240 | ||
242 | /* | 241 | /* |
@@ -275,13 +274,10 @@ int cache_check(struct cache_detail *detail, | |||
275 | if (!test_and_set_bit(CACHE_PENDING, &h->flags)) { | 274 | if (!test_and_set_bit(CACHE_PENDING, &h->flags)) { |
276 | switch (cache_make_upcall(detail, h)) { | 275 | switch (cache_make_upcall(detail, h)) { |
277 | case -EINVAL: | 276 | case -EINVAL: |
278 | clear_bit(CACHE_PENDING, &h->flags); | ||
279 | cache_revisit_request(h); | ||
280 | rv = try_to_negate_entry(detail, h); | 277 | rv = try_to_negate_entry(detail, h); |
281 | break; | 278 | break; |
282 | case -EAGAIN: | 279 | case -EAGAIN: |
283 | clear_bit(CACHE_PENDING, &h->flags); | 280 | cache_fresh_unlocked(h, detail); |
284 | cache_revisit_request(h); | ||
285 | break; | 281 | break; |
286 | } | 282 | } |
287 | } | 283 | } |
@@ -457,9 +453,7 @@ static int cache_clean(void) | |||
457 | current_index ++; | 453 | current_index ++; |
458 | spin_unlock(&cache_list_lock); | 454 | spin_unlock(&cache_list_lock); |
459 | if (ch) { | 455 | if (ch) { |
460 | if (test_and_clear_bit(CACHE_PENDING, &ch->flags)) | 456 | cache_fresh_unlocked(ch, d); |
461 | cache_dequeue(current_detail, ch); | ||
462 | cache_revisit_request(ch); | ||
463 | cache_put(ch, d); | 457 | cache_put(ch, d); |
464 | } | 458 | } |
465 | } else | 459 | } else |