mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-11-20 16:46:23 +08:00
[PATCH] knfsd: svcrpc: remove another silent drop from deferral code
There's no point deferring something just to immediately fail the deferral, especially now that we can do something more useful in the failure case by returning an error. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
e0bb89ef03
commit
01f3bd1f03
@ -530,6 +530,13 @@ static int cache_defer_req(struct cache_req *req, struct cache_head *item)
|
|||||||
struct cache_deferred_req *dreq;
|
struct cache_deferred_req *dreq;
|
||||||
int hash = DFR_HASH(item);
|
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);
|
dreq = req->defer(req);
|
||||||
if (dreq == NULL)
|
if (dreq == NULL)
|
||||||
return -ETIMEDOUT;
|
return -ETIMEDOUT;
|
||||||
@ -548,17 +555,8 @@ static int cache_defer_req(struct cache_req *req, struct cache_head *item)
|
|||||||
/* it is in, now maybe clean up */
|
/* it is in, now maybe clean up */
|
||||||
dreq = NULL;
|
dreq = NULL;
|
||||||
if (++cache_defer_cnt > DFR_MAX) {
|
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,
|
dreq = list_entry(cache_defer_list.prev,
|
||||||
struct cache_deferred_req,
|
struct cache_deferred_req, recent);
|
||||||
recent);
|
|
||||||
list_del(&dreq->recent);
|
list_del(&dreq->recent);
|
||||||
list_del(&dreq->hash);
|
list_del(&dreq->hash);
|
||||||
cache_defer_cnt--;
|
cache_defer_cnt--;
|
||||||
|
Loading…
Reference in New Issue
Block a user