diff options
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r-- | drivers/scsi/scsi_lib.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index db8c449282f9..9eff8a375132 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -221,7 +221,7 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, | |||
221 | int ret = DRIVER_ERROR << 24; | 221 | int ret = DRIVER_ERROR << 24; |
222 | 222 | ||
223 | req = blk_get_request(sdev->request_queue, write, __GFP_WAIT); | 223 | req = blk_get_request(sdev->request_queue, write, __GFP_WAIT); |
224 | if (!req) | 224 | if (IS_ERR(req)) |
225 | return ret; | 225 | return ret; |
226 | blk_rq_set_block_pc(req); | 226 | blk_rq_set_block_pc(req); |
227 | 227 | ||
@@ -715,7 +715,7 @@ static bool scsi_end_request(struct request *req, int error, | |||
715 | 715 | ||
716 | if (req->mq_ctx) { | 716 | if (req->mq_ctx) { |
717 | /* | 717 | /* |
718 | * In the MQ case the command gets freed by __blk_mq_end_io, | 718 | * In the MQ case the command gets freed by __blk_mq_end_request, |
719 | * so we have to do all cleanup that depends on it earlier. | 719 | * so we have to do all cleanup that depends on it earlier. |
720 | * | 720 | * |
721 | * We also can't kick the queues from irq context, so we | 721 | * We also can't kick the queues from irq context, so we |
@@ -723,7 +723,7 @@ static bool scsi_end_request(struct request *req, int error, | |||
723 | */ | 723 | */ |
724 | scsi_mq_uninit_cmd(cmd); | 724 | scsi_mq_uninit_cmd(cmd); |
725 | 725 | ||
726 | __blk_mq_end_io(req, error); | 726 | __blk_mq_end_request(req, error); |
727 | 727 | ||
728 | if (scsi_target(sdev)->single_lun || | 728 | if (scsi_target(sdev)->single_lun || |
729 | !list_empty(&sdev->host->starved_list)) | 729 | !list_empty(&sdev->host->starved_list)) |
@@ -1847,6 +1847,8 @@ static int scsi_mq_prep_fn(struct request *req) | |||
1847 | next_rq->special = bidi_sdb; | 1847 | next_rq->special = bidi_sdb; |
1848 | } | 1848 | } |
1849 | 1849 | ||
1850 | blk_mq_start_request(req); | ||
1851 | |||
1850 | return scsi_setup_cmnd(sdev, req); | 1852 | return scsi_setup_cmnd(sdev, req); |
1851 | } | 1853 | } |
1852 | 1854 | ||
@@ -1856,7 +1858,8 @@ static void scsi_mq_done(struct scsi_cmnd *cmd) | |||
1856 | blk_mq_complete_request(cmd->request); | 1858 | blk_mq_complete_request(cmd->request); |
1857 | } | 1859 | } |
1858 | 1860 | ||
1859 | static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *req) | 1861 | static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *req, |
1862 | bool last) | ||
1860 | { | 1863 | { |
1861 | struct request_queue *q = req->q; | 1864 | struct request_queue *q = req->q; |
1862 | struct scsi_device *sdev = q->queuedata; | 1865 | struct scsi_device *sdev = q->queuedata; |
@@ -1880,11 +1883,14 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *req) | |||
1880 | if (!scsi_host_queue_ready(q, shost, sdev)) | 1883 | if (!scsi_host_queue_ready(q, shost, sdev)) |
1881 | goto out_dec_target_busy; | 1884 | goto out_dec_target_busy; |
1882 | 1885 | ||
1886 | |||
1883 | if (!(req->cmd_flags & REQ_DONTPREP)) { | 1887 | if (!(req->cmd_flags & REQ_DONTPREP)) { |
1884 | ret = prep_to_mq(scsi_mq_prep_fn(req)); | 1888 | ret = prep_to_mq(scsi_mq_prep_fn(req)); |
1885 | if (ret) | 1889 | if (ret) |
1886 | goto out_dec_host_busy; | 1890 | goto out_dec_host_busy; |
1887 | req->cmd_flags |= REQ_DONTPREP; | 1891 | req->cmd_flags |= REQ_DONTPREP; |
1892 | } else { | ||
1893 | blk_mq_start_request(req); | ||
1888 | } | 1894 | } |
1889 | 1895 | ||
1890 | scsi_init_cmd_errh(cmd); | 1896 | scsi_init_cmd_errh(cmd); |
@@ -1931,6 +1937,14 @@ out: | |||
1931 | return ret; | 1937 | return ret; |
1932 | } | 1938 | } |
1933 | 1939 | ||
1940 | static enum blk_eh_timer_return scsi_timeout(struct request *req, | ||
1941 | bool reserved) | ||
1942 | { | ||
1943 | if (reserved) | ||
1944 | return BLK_EH_RESET_TIMER; | ||
1945 | return scsi_times_out(req); | ||
1946 | } | ||
1947 | |||
1934 | static int scsi_init_request(void *data, struct request *rq, | 1948 | static int scsi_init_request(void *data, struct request *rq, |
1935 | unsigned int hctx_idx, unsigned int request_idx, | 1949 | unsigned int hctx_idx, unsigned int request_idx, |
1936 | unsigned int numa_node) | 1950 | unsigned int numa_node) |
@@ -2042,7 +2056,7 @@ static struct blk_mq_ops scsi_mq_ops = { | |||
2042 | .map_queue = blk_mq_map_queue, | 2056 | .map_queue = blk_mq_map_queue, |
2043 | .queue_rq = scsi_queue_rq, | 2057 | .queue_rq = scsi_queue_rq, |
2044 | .complete = scsi_softirq_done, | 2058 | .complete = scsi_softirq_done, |
2045 | .timeout = scsi_times_out, | 2059 | .timeout = scsi_timeout, |
2046 | .init_request = scsi_init_request, | 2060 | .init_request = scsi_init_request, |
2047 | .exit_request = scsi_exit_request, | 2061 | .exit_request = scsi_exit_request, |
2048 | }; | 2062 | }; |