diff mbox series

scsi: fixup scsi_device_from_queue()

Message ID 20191018140355.108106-1-hare@suse.de (mailing list archive)
State Not Applicable
Headers show
Series scsi: fixup scsi_device_from_queue() | expand

Commit Message

Hannes Reinecke Oct. 18, 2019, 2:03 p.m. UTC
After commit 8930a6c20791 ("scsi: core: add support for request batching")
scsi_device_from_queue() will not work for devices implementing the
new scsi_mq_ops_no_commit template.
Hence multipath is not able to detect the underlying scsi devices
and multipath startup will fail.

Fixes: 8930a6c20791 ("scsi: core: add support for request batching")
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/scsi_lib.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Steffen Maier Oct. 18, 2019, 2:24 p.m. UTC | #1
Hannes, this is already in 
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git/log/?h=5.4/scsi-postmerge 
from 
https://lore.kernel.org/linux-block/20190807144948.28265-1-maier@linux.ibm.com/T/ 
and Martin just sent a pull request to Linus 
https://lore.kernel.org/linux-scsi/yq1pniui429.fsf@oracle.com/T/#m91f5b9098c369dc0d9bfef84aa53ee35533a31be

On 10/18/19 4:03 PM, Hannes Reinecke wrote:
> After commit 8930a6c20791 ("scsi: core: add support for request batching")
> scsi_device_from_queue() will not work for devices implementing the
> new scsi_mq_ops_no_commit template.
> Hence multipath is not able to detect the underlying scsi devices
> and multipath startup will fail.
> 
> Fixes: 8930a6c20791 ("scsi: core: add support for request batching")
> Signed-off-by: Hannes Reinecke <hare@suse.com>
> ---
>   drivers/scsi/scsi_lib.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index c1c2998297b2..cd3e21a0098c 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1924,7 +1924,8 @@ struct scsi_device *scsi_device_from_queue(struct request_queue *q)
>   {
>   	struct scsi_device *sdev = NULL;
> 
> -	if (q->mq_ops == &scsi_mq_ops)
> +	if (q->mq_ops == &scsi_mq_ops ||
> +	    q->mq_ops == &scsi_mq_ops_no_commit)
>   		sdev = q->queuedata;
>   	if (!sdev || !get_device(&sdev->sdev_gendev))
>   		sdev = NULL;
>
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index c1c2998297b2..cd3e21a0098c 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1924,7 +1924,8 @@  struct scsi_device *scsi_device_from_queue(struct request_queue *q)
 {
 	struct scsi_device *sdev = NULL;
 
-	if (q->mq_ops == &scsi_mq_ops)
+	if (q->mq_ops == &scsi_mq_ops ||
+	    q->mq_ops == &scsi_mq_ops_no_commit)
 		sdev = q->queuedata;
 	if (!sdev || !get_device(&sdev->sdev_gendev))
 		sdev = NULL;