diff options
author | Bart Van Assche <bart.vanassche@wdc.com> | 2017-08-30 19:58:42 -0400 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2017-08-31 23:09:49 -0400 |
commit | a45a1f3614182267803baadba657b59e2ddc0545 (patch) | |
tree | 0037ff3d93bb03e8b5578844447668afd2f0c4d6 | |
parent | cad8cf20a65f3d6cd70719bd0fec2d54546b12ef (diff) |
scsi: scsi-mq: Always unprepare before requeuing a request
One of the two scsi-mq functions that requeue a request unprepares a
request before requeueing (scsi_io_completion()) but the other function
not (__scsi_queue_insert()). Make sure that a request is unprepared
before requeuing it.
Fixes: commit d285203cf647 ("scsi: add support for a blk-mq based I/O path.")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Damien Le Moal <damien.lemoal@wdc.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/scsi_lib.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 6085377643ae..9cf6a80fe297 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -44,6 +44,8 @@ static struct kmem_cache *scsi_sense_cache; | |||
44 | static struct kmem_cache *scsi_sense_isadma_cache; | 44 | static struct kmem_cache *scsi_sense_isadma_cache; |
45 | static DEFINE_MUTEX(scsi_sense_cache_mutex); | 45 | static DEFINE_MUTEX(scsi_sense_cache_mutex); |
46 | 46 | ||
47 | static void scsi_mq_uninit_cmd(struct scsi_cmnd *cmd); | ||
48 | |||
47 | static inline struct kmem_cache * | 49 | static inline struct kmem_cache * |
48 | scsi_select_sense_cache(bool unchecked_isa_dma) | 50 | scsi_select_sense_cache(bool unchecked_isa_dma) |
49 | { | 51 | { |
@@ -140,6 +142,12 @@ static void scsi_mq_requeue_cmd(struct scsi_cmnd *cmd) | |||
140 | { | 142 | { |
141 | struct scsi_device *sdev = cmd->device; | 143 | struct scsi_device *sdev = cmd->device; |
142 | 144 | ||
145 | if (cmd->request->rq_flags & RQF_DONTPREP) { | ||
146 | cmd->request->rq_flags &= ~RQF_DONTPREP; | ||
147 | scsi_mq_uninit_cmd(cmd); | ||
148 | } else { | ||
149 | WARN_ON_ONCE(true); | ||
150 | } | ||
143 | blk_mq_requeue_request(cmd->request, true); | 151 | blk_mq_requeue_request(cmd->request, true); |
144 | put_device(&sdev->sdev_gendev); | 152 | put_device(&sdev->sdev_gendev); |
145 | } | 153 | } |
@@ -982,8 +990,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
982 | * A new command will be prepared and issued. | 990 | * A new command will be prepared and issued. |
983 | */ | 991 | */ |
984 | if (q->mq_ops) { | 992 | if (q->mq_ops) { |
985 | cmd->request->rq_flags &= ~RQF_DONTPREP; | ||
986 | scsi_mq_uninit_cmd(cmd); | ||
987 | scsi_mq_requeue_cmd(cmd); | 993 | scsi_mq_requeue_cmd(cmd); |
988 | } else { | 994 | } else { |
989 | scsi_release_buffers(cmd); | 995 | scsi_release_buffers(cmd); |