Commit e00c54c3 authored by Jens Axboe's avatar Jens Axboe

cfq-iosched: don't delay async queue if it hasn't dispatched at all

We cannot delay for the first dispatch of the async queue if it
hasn't dispatched at all, since that could present a local user
DoS attack vector using an app that just did slow timed sync reads
while filling memory.
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent ac481c20
...@@ -1345,16 +1345,9 @@ static int cfq_dispatch_requests(struct request_queue *q, int force) ...@@ -1345,16 +1345,9 @@ static int cfq_dispatch_requests(struct request_queue *q, int force)
unsigned long last_sync = jiffies - cfqd->last_end_sync_rq; unsigned long last_sync = jiffies - cfqd->last_end_sync_rq;
unsigned int depth; unsigned int depth;
/*
* must wait a bit longer
*/
if (last_sync < cfqd->cfq_slice[1]) {
cfq_schedule_dispatch(cfqd,
cfqd->cfq_slice[1] - last_sync);
return 0;
}
depth = last_sync / cfqd->cfq_slice[1]; depth = last_sync / cfqd->cfq_slice[1];
if (!depth && !cfqq->dispatched)
depth = 1;
if (depth < max_dispatch) if (depth < max_dispatch)
max_dispatch = depth; max_dispatch = depth;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment