Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 44504
b: refs/heads/master
c: 01f3bd1
h: refs/heads/master
v: v3
  • Loading branch information
J.Bruce Fields authored and Linus Torvalds committed Dec 13, 2006
1 parent abd2bf0 commit 37c507d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e0bb89ef031f76dcb9c9d920d18b13948f1418da
refs/heads/master: 01f3bd1f03599470e4695392b6ae055ed8506978
20 changes: 9 additions & 11 deletions trunk/net/sunrpc/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,13 @@ static int cache_defer_req(struct cache_req *req, struct cache_head *item)
struct cache_deferred_req *dreq;
int hash = DFR_HASH(item);

if (cache_defer_cnt >= DFR_MAX) {
/* too much in the cache, randomly drop this one,
* or continue and drop the oldest below
*/
if (net_random()&1)
return -ETIMEDOUT;
}
dreq = req->defer(req);
if (dreq == NULL)
return -ETIMEDOUT;
Expand All @@ -548,17 +555,8 @@ static int cache_defer_req(struct cache_req *req, struct cache_head *item)
/* it is in, now maybe clean up */
dreq = NULL;
if (++cache_defer_cnt > DFR_MAX) {
/* too much in the cache, randomly drop
* first or last
*/
if (net_random()&1)
dreq = list_entry(cache_defer_list.next,
struct cache_deferred_req,
recent);
else
dreq = list_entry(cache_defer_list.prev,
struct cache_deferred_req,
recent);
dreq = list_entry(cache_defer_list.prev,
struct cache_deferred_req, recent);
list_del(&dreq->recent);
list_del(&dreq->hash);
cache_defer_cnt--;
Expand Down

0 comments on commit 37c507d

Please sign in to comment.