diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2009-10-05 05:03:39 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-10-05 05:03:39 -0400 |
commit | 30996f40bffe73f05abb92a4cec254befa8cecf7 (patch) | |
tree | 2ce2cf9ed92aff3f930b7553711f4b439d6cb89e /block | |
parent | 374576a8b6f865022c0fd1ca62396889b23d66dd (diff) |
cfq-iosched: fix issue with rq-rq merging and fifo list ordering
cfq uses rq->start_time as the fifo indicator, but that field may
get modified prior to cfq doing it's fifo list adjustment when
a request gets merged with another request. This can cause the
fifo list to become unordered.
Reported-by: Corrado Zoccolo <czoccolo@gmail.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/cfq-iosched.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 9c4b679908f4..e7f9e4e3a270 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -827,8 +827,10 @@ cfq_merged_requests(struct request_queue *q, struct request *rq, | |||
827 | * reposition in fifo if next is older than rq | 827 | * reposition in fifo if next is older than rq |
828 | */ | 828 | */ |
829 | if (!list_empty(&rq->queuelist) && !list_empty(&next->queuelist) && | 829 | if (!list_empty(&rq->queuelist) && !list_empty(&next->queuelist) && |
830 | time_before(next->start_time, rq->start_time)) | 830 | time_before(rq_fifo_time(next), rq_fifo_time(rq))) { |
831 | list_move(&rq->queuelist, &next->queuelist); | 831 | list_move(&rq->queuelist, &next->queuelist); |
832 | rq_set_fifo_time(rq, rq_fifo_time(next)); | ||
833 | } | ||
832 | 834 | ||
833 | cfq_remove_request(next); | 835 | cfq_remove_request(next); |
834 | } | 836 | } |
@@ -1129,9 +1131,7 @@ static void cfq_dispatch_insert(struct request_queue *q, struct request *rq) | |||
1129 | */ | 1131 | */ |
1130 | static struct request *cfq_check_fifo(struct cfq_queue *cfqq) | 1132 | static struct request *cfq_check_fifo(struct cfq_queue *cfqq) |
1131 | { | 1133 | { |
1132 | struct cfq_data *cfqd = cfqq->cfqd; | 1134 | struct request *rq = NULL; |
1133 | struct request *rq; | ||
1134 | int fifo; | ||
1135 | 1135 | ||
1136 | if (cfq_cfqq_fifo_expire(cfqq)) | 1136 | if (cfq_cfqq_fifo_expire(cfqq)) |
1137 | return NULL; | 1137 | return NULL; |
@@ -1141,13 +1141,11 @@ static struct request *cfq_check_fifo(struct cfq_queue *cfqq) | |||
1141 | if (list_empty(&cfqq->fifo)) | 1141 | if (list_empty(&cfqq->fifo)) |
1142 | return NULL; | 1142 | return NULL; |
1143 | 1143 | ||
1144 | fifo = cfq_cfqq_sync(cfqq); | ||
1145 | rq = rq_entry_fifo(cfqq->fifo.next); | 1144 | rq = rq_entry_fifo(cfqq->fifo.next); |
1146 | 1145 | if (time_before(jiffies, rq_fifo_time(rq))) | |
1147 | if (time_before(jiffies, rq->start_time + cfqd->cfq_fifo_expire[fifo])) | ||
1148 | rq = NULL; | 1146 | rq = NULL; |
1149 | 1147 | ||
1150 | cfq_log_cfqq(cfqd, cfqq, "fifo=%p", rq); | 1148 | cfq_log_cfqq(cfqq->cfqd, cfqq, "fifo=%p", rq); |
1151 | return rq; | 1149 | return rq; |
1152 | } | 1150 | } |
1153 | 1151 | ||
@@ -2130,6 +2128,7 @@ static void cfq_insert_request(struct request_queue *q, struct request *rq) | |||
2130 | 2128 | ||
2131 | cfq_add_rq_rb(rq); | 2129 | cfq_add_rq_rb(rq); |
2132 | 2130 | ||
2131 | rq_set_fifo_time(rq, jiffies + cfqd->cfq_fifo_expire[rq_is_sync(rq)]); | ||
2133 | list_add_tail(&rq->queuelist, &cfqq->fifo); | 2132 | list_add_tail(&rq->queuelist, &cfqq->fifo); |
2134 | 2133 | ||
2135 | cfq_rq_enqueued(cfqd, cfqq, rq); | 2134 | cfq_rq_enqueued(cfqd, cfqq, rq); |