Skip to contentSkip to conversation

scsi: fixup scsi_device_from_queue()

PATCH In review Hannes Reinecke 2 participants 2 messages Oct 18, 2019 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: fixup scsi_device_from_queue()

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")
---
 drivers/scsi/scsi_lib.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/scsi_lib.c +2 -1
index c1c2998297b2..cd3e21a0098c 100644
@@ -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;
Signature · 1 line
2.16.4
#1 lore raw

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/[email protected]/T/ and Martin just sent a pull request to Linus https://lore.kernel.org/linux-scsi/[email protected]/T/#m91f5b9098c369dc0d9bfef84aa53ee35533a31be

Quoted 27 lines · Hannes Reinecke

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")
---
  drivers/scsi/scsi_lib.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/scsi_lib.c +2 -1
index c1c2998297b2..cd3e21a0098c 100644
@@ -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;
Signature · 11 lines
Mit freundlichen Gruessen / Kind regards
Steffen Maier

Linux on IBM Z Development

https://www.ibm.com/privacy/us/en/
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Matthias Hartmann
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294