]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.25/patches.drivers/block-add-timeout-on-dequeue
Reenabled linux-xen and xen-image build
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.drivers / block-add-timeout-on-dequeue
CommitLineData
00e5a55c
BS
1From: Tejun Heo <tj@kernel.org>
2Subject: block: add timer on blkdev_dequeue_request() not elv_next_request()
3References: bnc#440076
4
5Block queue supports two usage models - one where block driver peeks
6at the front of queue using elv_next_request(), processes it and
7finishes it and the other where block driver peeks at the front of
8queue, dequeue the request using blkdev_dequeue_request() and finishes
9it. The latter is more flexible as it allows the driver to process
10multiple commands concurrently.
11
12These two inconsistent usage models affect the block layer
13implementation confusing. For some, elv_next_request() is considered
14the issue point while others consider blkdev_dequeue_request() the
15issue point.
16
17Till now the inconsistency mostly affect only accounting, so it didn't
18really break anything seriously; however, with block layer timeout,
19this inconsistency hits hard. Block layer considers
20elv_next_request() the issue point and adds timer but SCSI layer
21thinks it was just peeking and when the request can't process the
22command right away, it's just left there without further processing.
23This makes the request dangling on the timer list and, when the timer
24goes off, the request which the SCSI layer and below think is still on
25the block queue ends up in the EH queue, causing various problems - EH
26hang (failed count goes over busy count and EH never wakes up),
27WARN_ON() and oopses as low level driver trying to handle the unknown
28command, etc. depending on the timing.
29
30As SCSI midlayer is the only user of block layer timer at the moment,
31moving blk_add_timer() to elv_dequeue_request() fixes the problem;
32however, this two usage models definitely need to be cleaned up in the
33future.
34
35Signed-off-by: Tejun Heo <tj@kernel.org>
36Signed-off-by: Tejun Heo <teheo@suse.de>
37---
38 block/elevator.c | 12 ++++++------
39 1 file changed, 6 insertions(+), 6 deletions(-)
40
41Index: linux-2.6.27/block/elevator.c
42===================================================================
43--- linux-2.6.27.orig/block/elevator.c
44+++ linux-2.6.27/block/elevator.c
45@@ -773,12 +773,6 @@ struct request *elv_next_request(struct
46 */
47 rq->cmd_flags |= REQ_STARTED;
48 blk_add_trace_rq(q, rq, BLK_TA_ISSUE);
49-
50- /*
51- * We are now handing the request to the hardware,
52- * add the timeout handler
53- */
54- blk_add_timer(rq);
55 }
56
57 if (!q->boundary_rq || q->boundary_rq == rq) {
58@@ -850,6 +844,12 @@ void elv_dequeue_request(struct request_
59 */
60 if (blk_account_rq(rq))
61 q->in_flight++;
62+
63+ /*
64+ * We are now handing the request to the hardware, add the
65+ * timeout handler.
66+ */
67+ blk_add_timer(rq);
68 }
69 EXPORT_SYMBOL(elv_dequeue_request);
70