All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] - mpt fusion -
@ 2006-04-13 22:08 Moore, Eric
  2006-04-14  1:04 ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Moore, Eric @ 2006-04-13 22:08 UTC (permalink / raw)
  To: linux-scsi; +Cc: James.Bottomley

[-- Attachment #1: Type: text/plain, Size: 1291 bytes --]

Bug fix - Due to a recent change in scsi_transport_sas,
in the function sas_rphy_add(), its possible to have the
same target mapped to two different device nodes, 
meaning /dev/sda at id=0 and /dev/sdb at id=1, are remapped
in mptsas to the same device at id=foo.

I'll explain the problem.
The sas drivers have a rphy to rphy relationship.  An rphy
created on a hba phy points to the expander phy.  Then the expander
phy creates a rphy pointing back to the same hba rphy. The expander
phy which contains the rphy pointing back to the hba phy, contains
the attributes device_type = SAS_END_DEVICE, and target_port_protocals =
0.
Hence the recent change in sas_rphy_add() make it drop down to
scsi_scan_target, whereas before there was sepecial handling to 
prevent this case from happening.  With this change, the mptsas slave
entry 
points are called to enumerate the rphy that points back to the hba phy.
The target id in our data structures is the same as a real target device
on another phy.  Thus we end up mapping the same target to two different
rphys.
To fix this, I added a check in mptsas_slave_alloc to make sure the
requested rphy is mapped to a true end device.

JEJB: Pls apply to scsi-rc-fixes tree.

Signed-off-by: Eric Moore <Eric.Moore@lsil.com>

[-- Attachment #2: duplicate_targets.patch --]
[-- Type: application/octet-stream, Size: 1988 bytes --]

diff -uarN b/drivers/message/fusion/mptsas.c a/drivers/message/fusion/mptsas.c
--- b/drivers/message/fusion/mptsas.c	2006-04-13 15:08:27.000000000 -0600
+++ a/drivers/message/fusion/mptsas.c	2006-04-13 15:11:15.000000000 -0600
@@ -298,6 +298,26 @@
 	return rc;
 }
 
+/*
+ * Returns true if there is a scsi end device
+ */
+static inline int
+mptsas_is_end_device(struct mptsas_devinfo * attached)
+{
+	if ((attached->handle) &&
+	    (attached->device_info &
+	    MPI_SAS_DEVICE_INFO_END_DEVICE) &&
+	    ((attached->device_info &
+	    MPI_SAS_DEVICE_INFO_SSP_TARGET) |
+	    (attached->device_info &
+	    MPI_SAS_DEVICE_INFO_STP_TARGET) |
+	    (attached->device_info &
+	    MPI_SAS_DEVICE_INFO_SATA_DEVICE)))
+		return 1;
+	else
+		return 0;
+}
+
 static int
 mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc, struct mptsas_enclosure *enclosure,
 		u32 form, u32 form_specific)
@@ -429,6 +449,9 @@
 		for (i = 0; i < p->num_phys; i++) {
 			if (p->phy_info[i].attached.sas_address ==
 					rphy->identify.sas_address) {
+				if (!mptsas_is_end_device(
+					&p->phy_info[i].attached))
+					goto out_no_dev;
 				target_id = p->phy_info[i].attached.id;
 				vtarget->bus_id = p->phy_info[i].attached.channel;
 				vdev->lun = sdev->lun;
@@ -448,6 +471,7 @@
 			}
 		}
 	}
+ out_no_dev:
 	mutex_unlock(&hd->ioc->sas_topology_mutex);
 
 	kfree(vdev);
@@ -1068,26 +1092,6 @@
 	return error;
 }
 
-/*
- * Returns true if there is a scsi end device
- */
-static inline int
-mptsas_is_end_device(struct mptsas_devinfo * attached)
-{
-	if ((attached->handle) &&
-	    (attached->device_info &
-	    MPI_SAS_DEVICE_INFO_END_DEVICE) &&
-	    ((attached->device_info &
-	    MPI_SAS_DEVICE_INFO_SSP_TARGET) |
-	    (attached->device_info &
-	    MPI_SAS_DEVICE_INFO_STP_TARGET) |
-	    (attached->device_info &
-	    MPI_SAS_DEVICE_INFO_SATA_DEVICE)))
-		return 1;
-	else
-		return 0;
-}
-
 static void
 mptsas_parse_device_info(struct sas_identify *identify,
 		struct mptsas_devinfo *device_info)

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-04-15  0:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-13 22:08 [PATCH 2/3] - mpt fusion - Moore, Eric
2006-04-14  1:04 ` Christoph Hellwig
2006-04-14  2:14   ` Moore, Eric
2006-04-14 14:47     ` James Bottomley
2006-04-15  0:45       ` Moore, Eric
2006-04-15  0:56         ` 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.