diff options
-rw-r--r-- | net/sunrpc/cache.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index e433e7580e27..0d6002f26d82 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | #define RPCDBG_FACILITY RPCDBG_CACHE | 38 | #define RPCDBG_FACILITY RPCDBG_CACHE |
39 | 39 | ||
40 | static void cache_defer_req(struct cache_req *req, struct cache_head *item); | 40 | static bool cache_defer_req(struct cache_req *req, struct cache_head *item); |
41 | static void cache_revisit_request(struct cache_head *item); | 41 | static void cache_revisit_request(struct cache_head *item); |
42 | 42 | ||
43 | static void cache_init(struct cache_head *h) | 43 | static void cache_init(struct cache_head *h) |
@@ -268,9 +268,11 @@ int cache_check(struct cache_detail *detail, | |||
268 | } | 268 | } |
269 | 269 | ||
270 | if (rv == -EAGAIN) { | 270 | if (rv == -EAGAIN) { |
271 | cache_defer_req(rqstp, h); | 271 | if (!cache_defer_req(rqstp, h)) { |
272 | if (!test_bit(CACHE_PENDING, &h->flags)) { | 272 | /* |
273 | /* Request is not deferred */ | 273 | * Request was not deferred; handle it as best |
274 | * we can ourselves: | ||
275 | */ | ||
274 | rv = cache_is_valid(detail, h); | 276 | rv = cache_is_valid(detail, h); |
275 | if (rv == -EAGAIN) | 277 | if (rv == -EAGAIN) |
276 | rv = -ETIMEDOUT; | 278 | rv = -ETIMEDOUT; |
@@ -618,18 +620,19 @@ static void cache_limit_defers(void) | |||
618 | discard->revisit(discard, 1); | 620 | discard->revisit(discard, 1); |
619 | } | 621 | } |
620 | 622 | ||
621 | static void cache_defer_req(struct cache_req *req, struct cache_head *item) | 623 | /* Return true if and only if a deferred request is queued. */ |
624 | static bool cache_defer_req(struct cache_req *req, struct cache_head *item) | ||
622 | { | 625 | { |
623 | struct cache_deferred_req *dreq; | 626 | struct cache_deferred_req *dreq; |
624 | 627 | ||
625 | if (req->thread_wait) { | 628 | if (req->thread_wait) { |
626 | cache_wait_req(req, item); | 629 | cache_wait_req(req, item); |
627 | if (!test_bit(CACHE_PENDING, &item->flags)) | 630 | if (!test_bit(CACHE_PENDING, &item->flags)) |
628 | return; | 631 | return false; |
629 | } | 632 | } |
630 | dreq = req->defer(req); | 633 | dreq = req->defer(req); |
631 | if (dreq == NULL) | 634 | if (dreq == NULL) |
632 | return; | 635 | return false; |
633 | setup_deferral(dreq, item, 1); | 636 | setup_deferral(dreq, item, 1); |
634 | if (!test_bit(CACHE_PENDING, &item->flags)) | 637 | if (!test_bit(CACHE_PENDING, &item->flags)) |
635 | /* Bit could have been cleared before we managed to | 638 | /* Bit could have been cleared before we managed to |
@@ -638,6 +641,7 @@ static void cache_defer_req(struct cache_req *req, struct cache_head *item) | |||
638 | cache_revisit_request(item); | 641 | cache_revisit_request(item); |
639 | 642 | ||
640 | cache_limit_defers(); | 643 | cache_limit_defers(); |
644 | return true; | ||
641 | } | 645 | } |
642 | 646 | ||
643 | static void cache_revisit_request(struct cache_head *item) | 647 | static void cache_revisit_request(struct cache_head *item) |