diff options
Diffstat (limited to 'block/blk-exec.c')
-rw-r--r-- | block/blk-exec.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/block/blk-exec.c b/block/blk-exec.c index e1672f14840e..8a0e7ec056e7 100644 --- a/block/blk-exec.c +++ b/block/blk-exec.c | |||
@@ -54,9 +54,9 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk, | |||
54 | rq->end_io = done; | 54 | rq->end_io = done; |
55 | WARN_ON(irqs_disabled()); | 55 | WARN_ON(irqs_disabled()); |
56 | spin_lock_irq(q->queue_lock); | 56 | spin_lock_irq(q->queue_lock); |
57 | __elv_add_request(q, rq, where, 1); | 57 | __elv_add_request(q, rq, where); |
58 | __generic_unplug_device(q); | 58 | __blk_run_queue(q); |
59 | /* the queue is stopped so it won't be plugged+unplugged */ | 59 | /* the queue is stopped so it won't be run */ |
60 | if (rq->cmd_type == REQ_TYPE_PM_RESUME) | 60 | if (rq->cmd_type == REQ_TYPE_PM_RESUME) |
61 | q->request_fn(q); | 61 | q->request_fn(q); |
62 | spin_unlock_irq(q->queue_lock); | 62 | spin_unlock_irq(q->queue_lock); |
@@ -80,6 +80,7 @@ int blk_execute_rq(struct request_queue *q, struct gendisk *bd_disk, | |||
80 | DECLARE_COMPLETION_ONSTACK(wait); | 80 | DECLARE_COMPLETION_ONSTACK(wait); |
81 | char sense[SCSI_SENSE_BUFFERSIZE]; | 81 | char sense[SCSI_SENSE_BUFFERSIZE]; |
82 | int err = 0; | 82 | int err = 0; |
83 | unsigned long hang_check; | ||
83 | 84 | ||
84 | /* | 85 | /* |
85 | * we need an extra reference to the request, so we can look at | 86 | * we need an extra reference to the request, so we can look at |
@@ -95,7 +96,13 @@ int blk_execute_rq(struct request_queue *q, struct gendisk *bd_disk, | |||
95 | 96 | ||
96 | rq->end_io_data = &wait; | 97 | rq->end_io_data = &wait; |
97 | blk_execute_rq_nowait(q, bd_disk, rq, at_head, blk_end_sync_rq); | 98 | blk_execute_rq_nowait(q, bd_disk, rq, at_head, blk_end_sync_rq); |
98 | wait_for_completion(&wait); | 99 | |
100 | /* Prevent hang_check timer from firing at us during very long I/O */ | ||
101 | hang_check = sysctl_hung_task_timeout_secs; | ||
102 | if (hang_check) | ||
103 | while (!wait_for_completion_timeout(&wait, hang_check * (HZ/2))); | ||
104 | else | ||
105 | wait_for_completion(&wait); | ||
99 | 106 | ||
100 | if (rq->errors) | 107 | if (rq->errors) |
101 | err = -EIO; | 108 | err = -EIO; |