From: James Bottomley <James.Bottomley@SteelEye.com>
To: SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: [PATCH] fix multiple HBA problem with transport classes
Date: Sat, 29 Jan 2005 19:37:59 -0600 [thread overview]
Message-ID: <1107049079.4535.35.camel@mulgrave> (raw)
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,
reply other threads:[~2005-01-30 1:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1107049079.4535.35.camel@mulgrave \
--to=james.bottomley@steeleye.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox