summaryrefslogtreecommitdiff
path: root/block/cfq-iosched.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-10-04 22:36:19 +0400
committerJens Axboe <jens.axboe@oracle.com>2009-10-04 22:36:19 +0400
commite00c54c36ac2024c3a8a37432e2e2698ff849594 (patch)
tree0b392ba588939a7ee0c405ada8b22047fad9daff /block/cfq-iosched.c
parentac481c20ef8f6c6f2be75d581863f40c43874ef7 (diff)
downloadlinux-e00c54c36ac2024c3a8a37432e2e2698ff849594.tar.xz
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: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r--block/cfq-iosched.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index ebab60c6be9d..9c4b679908f4 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -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;
}