fix multiple HBA problem with transport classes
PATCH 1/1 fix multiple HBA problem with transport classes
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 =====
drivers/scsi/scsi_transport_fc.c +10 -2
@@ -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 =====
drivers/scsi/scsi_transport_iscsi.c +10 -2
@@ -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 =====
drivers/scsi/scsi_transport_spi.c +10 -2
@@ -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,