All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix multiple HBA problem with transport classes
@ 2005-01-30  1:37 James Bottomley
  0 siblings, 0 replies; only message in thread
From: James Bottomley @ 2005-01-30  1:37 UTC (permalink / raw)
  To: SCSI Mailing List

All of the transport class patches contain a thinko in device matching
(and, unfortunately, one I exhorted everyone not to make in the generic
transport class comments): The match matches every container in the
class instead of the specific container belonging to the HBA.  This
causes a oops when there are two or more HBAs in the system.

James

===== drivers/scsi/scsi_transport_fc.c 1.14 vs edited =====
--- 1.14/drivers/scsi/scsi_transport_fc.c	2005-01-18 13:15:07 -06:00
+++ edited/drivers/scsi/scsi_transport_fc.c	2005-01-29 18:53:19 -06:00
@@ -728,6 +728,7 @@
 			  struct device *dev)
 {
 	struct Scsi_Host *shost;
+	struct fc_internal *i;
 
 	if (!scsi_is_host_device(dev))
 		return 0;
@@ -736,13 +737,17 @@
 	if (!shost->transportt  || shost->transportt->host_attrs.class
 	    != &fc_host_class.class)
 		return 0;
-	return 1;
+
+	i = to_fc_internal(shost->transportt);
+	
+	return &i->t.host_attrs == cont;
 }
 
 static int fc_target_match(struct attribute_container *cont,
 			    struct device *dev)
 {
 	struct Scsi_Host *shost;
+	struct fc_internal *i;
 
 	if (!scsi_is_target_device(dev))
 		return 0;
@@ -751,7 +756,10 @@
 	if (!shost->transportt  || shost->transportt->host_attrs.class
 	    != &fc_host_class.class)
 		return 0;
-	return 1;
+
+	i = to_fc_internal(shost->transportt);
+	
+	return &i->t.host_attrs == cont;
 }
 
 
===== drivers/scsi/scsi_transport_iscsi.c 1.2 vs edited =====
--- 1.2/drivers/scsi/scsi_transport_iscsi.c	2005-01-18 13:15:07 -06:00
+++ edited/drivers/scsi/scsi_transport_iscsi.c	2005-01-29 18:56:01 -06:00
@@ -258,6 +258,7 @@
 			  struct device *dev)
 {
 	struct Scsi_Host *shost;
+	struct iscsi_internal *i;
 
 	if (!scsi_is_host_device(dev))
 		return 0;
@@ -266,13 +267,17 @@
 	if (!shost->transportt  || shost->transportt->host_attrs.class
 	    != &iscsi_host_class.class)
 		return 0;
-	return 1;
+
+	i = to_iscsi_internal(shost->transportt);
+	
+	return &i->t.host_attrs == cont;
 }
 
 static int iscsi_target_match(struct attribute_container *cont,
 			    struct device *dev)
 {
 	struct Scsi_Host *shost;
+	struct iscsi_internal *i;
 
 	if (!scsi_is_target_device(dev))
 		return 0;
@@ -281,7 +286,10 @@
 	if (!shost->transportt  || shost->transportt->host_attrs.class
 	    != &iscsi_host_class.class)
 		return 0;
-	return 1;
+
+	i = to_iscsi_internal(shost->transportt);
+	
+	return &i->t.host_attrs == cont;
 }
 
 struct scsi_transport_template *
===== drivers/scsi/scsi_transport_spi.c 1.23 vs edited =====
--- 1.23/drivers/scsi/scsi_transport_spi.c	2005-01-18 13:15:07 -06:00
+++ edited/drivers/scsi/scsi_transport_spi.c	2005-01-29 18:33:18 -06:00
@@ -136,6 +136,7 @@
 			  struct device *dev)
 {
 	struct Scsi_Host *shost;
+	struct spi_internal *i;
 
 	if (!scsi_is_host_device(dev))
 		return 0;
@@ -144,7 +145,10 @@
 	if (!shost->transportt  || shost->transportt->host_attrs.class
 	    != &spi_host_class.class)
 		return 0;
-	return 1;
+
+	i = to_spi_internal(shost->transportt);
+	
+	return &i->t.target_attrs == cont;
 }
 
 static int spi_device_configure(struct device *dev)
@@ -831,6 +835,7 @@
 			    struct device *dev)
 {
 	struct Scsi_Host *shost;
+	struct spi_internal *i;
 
 	if (!scsi_is_target_device(dev))
 		return 0;
@@ -839,7 +844,10 @@
 	if (!shost->transportt  || shost->transportt->host_attrs.class
 	    != &spi_host_class.class)
 		return 0;
-	return 1;
+
+	i = to_spi_internal(shost->transportt);
+	
+	return &i->t.target_attrs == cont;
 }
 
 static DECLARE_TRANSPORT_CLASS(spi_transport_class,



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-01-30  1:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-30  1:37 [PATCH] fix multiple HBA problem with transport classes James Bottomley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.