diff options
author | Tejun Heo <tj@kernel.org> | 2008-12-03 06:41:26 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-12-03 06:41:26 -0500 |
commit | 53a08807c01989c6847bb135d8d43f61c5dfdda5 (patch) | |
tree | e2297de901dc82a0336e6af28b594864792c585d | |
parent | bf91db18ac2852a3ff39fe25ff56c5557c0fff78 (diff) |
block: internal dequeue shouldn't start timer
blkdev_dequeue_request() and elv_dequeue_request() are equivalent and
both start the timeout timer. Barrier code dequeues the original
barrier request but doesn't passes the request itself to lower level
driver, only broken down proxy requests; however, as the original
barrier code goes through the same dequeue path and timeout timer is
started on it. If barrier sequence takes long enough, this timer
expires but the low level driver has no idea about this request and
oops follows.
Timeout timer shouldn't have been started on the original barrier
request as it never goes through actual IO. This patch unexports
elv_dequeue_request(), which has no external user anyway, and makes it
operate on elevator proper w/o adding the timer and make
blkdev_dequeue_request() call elv_dequeue_request() and add timer.
Internal users which don't pass the request to driver - barrier code
and end_that_request_last() - are converted to use
elv_dequeue_request().
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Mike Anderson <andmike@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r-- | block/blk-barrier.c | 4 | ||||
-rw-r--r-- | block/blk-core.c | 24 | ||||
-rw-r--r-- | block/elevator.c | 7 | ||||
-rw-r--r-- | include/linux/blkdev.h | 7 |
4 files changed, 27 insertions, 15 deletions
diff --git a/block/blk-barrier.c b/block/blk-barrier.c index 5c99ff8d2db8..6e72d661ae42 100644 --- a/block/blk-barrier.c +++ b/block/blk-barrier.c | |||
@@ -161,7 +161,7 @@ static inline struct request *start_ordered(struct request_queue *q, | |||
161 | /* | 161 | /* |
162 | * Prep proxy barrier request. | 162 | * Prep proxy barrier request. |
163 | */ | 163 | */ |
164 | blkdev_dequeue_request(rq); | 164 | elv_dequeue_request(q, rq); |
165 | q->orig_bar_rq = rq; | 165 | q->orig_bar_rq = rq; |
166 | rq = &q->bar_rq; | 166 | rq = &q->bar_rq; |
167 | blk_rq_init(q, rq); | 167 | blk_rq_init(q, rq); |
@@ -219,7 +219,7 @@ int blk_do_ordered(struct request_queue *q, struct request **rqp) | |||
219 | * This can happen when the queue switches to | 219 | * This can happen when the queue switches to |
220 | * ORDERED_NONE while this request is on it. | 220 | * ORDERED_NONE while this request is on it. |
221 | */ | 221 | */ |
222 | blkdev_dequeue_request(rq); | 222 | elv_dequeue_request(q, rq); |
223 | if (__blk_end_request(rq, -EOPNOTSUPP, | 223 | if (__blk_end_request(rq, -EOPNOTSUPP, |
224 | blk_rq_bytes(rq))) | 224 | blk_rq_bytes(rq))) |
225 | BUG(); | 225 | BUG(); |
diff --git a/block/blk-core.c b/block/blk-core.c index 10e8a64a5a5b..7a779d7c69c9 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -1637,6 +1637,28 @@ int blk_insert_cloned_request(struct request_queue *q, struct request *rq) | |||
1637 | EXPORT_SYMBOL_GPL(blk_insert_cloned_request); | 1637 | EXPORT_SYMBOL_GPL(blk_insert_cloned_request); |
1638 | 1638 | ||
1639 | /** | 1639 | /** |
1640 | * blkdev_dequeue_request - dequeue request and start timeout timer | ||
1641 | * @req: request to dequeue | ||
1642 | * | ||
1643 | * Dequeue @req and start timeout timer on it. This hands off the | ||
1644 | * request to the driver. | ||
1645 | * | ||
1646 | * Block internal functions which don't want to start timer should | ||
1647 | * call elv_dequeue_request(). | ||
1648 | */ | ||
1649 | void blkdev_dequeue_request(struct request *req) | ||
1650 | { | ||
1651 | elv_dequeue_request(req->q, req); | ||
1652 | |||
1653 | /* | ||
1654 | * We are now handing the request to the hardware, add the | ||
1655 | * timeout handler. | ||
1656 | */ | ||
1657 | blk_add_timer(req); | ||
1658 | } | ||
1659 | EXPORT_SYMBOL(blkdev_dequeue_request); | ||
1660 | |||
1661 | /** | ||
1640 | * __end_that_request_first - end I/O on a request | 1662 | * __end_that_request_first - end I/O on a request |
1641 | * @req: the request being processed | 1663 | * @req: the request being processed |
1642 | * @error: %0 for success, < %0 for error | 1664 | * @error: %0 for success, < %0 for error |
@@ -1774,7 +1796,7 @@ static void end_that_request_last(struct request *req, int error) | |||
1774 | blk_queue_end_tag(req->q, req); | 1796 | blk_queue_end_tag(req->q, req); |
1775 | 1797 | ||
1776 | if (blk_queued_rq(req)) | 1798 | if (blk_queued_rq(req)) |
1777 | blkdev_dequeue_request(req); | 1799 | elv_dequeue_request(req->q, req); |
1778 | 1800 | ||
1779 | if (unlikely(laptop_mode) && blk_fs_request(req)) | 1801 | if (unlikely(laptop_mode) && blk_fs_request(req)) |
1780 | laptop_io_completion(); | 1802 | laptop_io_completion(); |
diff --git a/block/elevator.c b/block/elevator.c index 9ac82dde99dd..a6951f76ba0c 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -844,14 +844,7 @@ void elv_dequeue_request(struct request_queue *q, struct request *rq) | |||
844 | */ | 844 | */ |
845 | if (blk_account_rq(rq)) | 845 | if (blk_account_rq(rq)) |
846 | q->in_flight++; | 846 | q->in_flight++; |
847 | |||
848 | /* | ||
849 | * We are now handing the request to the hardware, add the | ||
850 | * timeout handler. | ||
851 | */ | ||
852 | blk_add_timer(rq); | ||
853 | } | 847 | } |
854 | EXPORT_SYMBOL(elv_dequeue_request); | ||
855 | 848 | ||
856 | int elv_queue_empty(struct request_queue *q) | 849 | int elv_queue_empty(struct request_queue *q) |
857 | { | 850 | { |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index a135256b272c..9cc7cc5fdce1 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -786,6 +786,8 @@ static inline void blk_run_address_space(struct address_space *mapping) | |||
786 | blk_run_backing_dev(mapping->backing_dev_info, NULL); | 786 | blk_run_backing_dev(mapping->backing_dev_info, NULL); |
787 | } | 787 | } |
788 | 788 | ||
789 | extern void blkdev_dequeue_request(struct request *req); | ||
790 | |||
789 | /* | 791 | /* |
790 | * blk_end_request() and friends. | 792 | * blk_end_request() and friends. |
791 | * __blk_end_request() and end_request() must be called with | 793 | * __blk_end_request() and end_request() must be called with |
@@ -820,11 +822,6 @@ extern void blk_update_request(struct request *rq, int error, | |||
820 | extern unsigned int blk_rq_bytes(struct request *rq); | 822 | extern unsigned int blk_rq_bytes(struct request *rq); |
821 | extern unsigned int blk_rq_cur_bytes(struct request *rq); | 823 | extern unsigned int blk_rq_cur_bytes(struct request *rq); |
822 | 824 | ||
823 | static inline void blkdev_dequeue_request(struct request *req) | ||
824 | { | ||
825 | elv_dequeue_request(req->q, req); | ||
826 | } | ||
827 | |||
828 | /* | 825 | /* |
829 | * Access functions for manipulating queue properties | 826 | * Access functions for manipulating queue properties |
830 | */ | 827 | */ |