Skip to content

Commit

Permalink
cfq-iosched: don't delay async queue if it hasn't dispatched at all
Browse files Browse the repository at this point in the history
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: Jens Axboe <[email protected]>
  • Loading branch information
Jens Axboe committed Oct 4, 2009
1 parent ac481c2 commit e00c54c
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 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];
if (!depth && !cfqq->dispatched)
depth = 1;
if (depth < max_dispatch)
max_dispatch = depth;
}
Expand Down

0 comments on commit e00c54c

Please sign in to comment.