From fec760c2f3326f698b4e387fd5634a273c3277cf Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" Date: Mon, 3 Jan 2011 15:10:27 -0500 Subject: [PATCH] --- yaml --- r: 231155 b: refs/heads/master c: 6bab93f87ec703bf6650875881b11f9f27d7da56 h: refs/heads/master i: 231153: 2bccc484d823bf4656a86b15c860a7136dd6f319 231151: 10d3547c64e9089972b54fccbcc417a4766d73c5 v: v3 --- [refs] | 2 +- trunk/net/sunrpc/cache.c | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/[refs] b/[refs] index b6ce972f1ef1..22477549bc40 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: da165dd60e136d0609e0a2c0c2a9b9a5372200d6 +refs/heads/master: 6bab93f87ec703bf6650875881b11f9f27d7da56 diff --git a/trunk/net/sunrpc/cache.c b/trunk/net/sunrpc/cache.c index 0d6002f26d82..a6c57334fa13 100644 --- a/trunk/net/sunrpc/cache.c +++ b/trunk/net/sunrpc/cache.c @@ -213,6 +213,23 @@ static inline int cache_is_valid(struct cache_detail *detail, struct cache_head } } +static int try_to_negate_entry(struct cache_detail *detail, struct cache_head *h) +{ + int rv; + + write_lock(&detail->hash_lock); + rv = cache_is_valid(detail, h); + if (rv != -EAGAIN) { + write_unlock(&detail->hash_lock); + return rv; + } + set_bit(CACHE_NEGATIVE, &h->flags); + cache_fresh_locked(h, seconds_since_boot()+CACHE_NEW_EXPIRY); + write_unlock(&detail->hash_lock); + cache_fresh_unlocked(h, detail); + return -ENOENT; +} + /* * This is the generic cache management routine for all * the authentication caches. @@ -251,14 +268,8 @@ int cache_check(struct cache_detail *detail, case -EINVAL: clear_bit(CACHE_PENDING, &h->flags); cache_revisit_request(h); - if (rv == -EAGAIN) { - set_bit(CACHE_NEGATIVE, &h->flags); - cache_fresh_locked(h, seconds_since_boot()+CACHE_NEW_EXPIRY); - cache_fresh_unlocked(h, detail); - rv = -ENOENT; - } + rv = try_to_negate_entry(detail, h); break; - case -EAGAIN: clear_bit(CACHE_PENDING, &h->flags); cache_revisit_request(h);