From: Tomas Henzl <thenzl@redhat.com> Date: Mon, 15 Nov 2010 13:13:23 -0500 Subject: [scsi] mpt2sas: use sas device list for enclosure id Message-id: <4CE131F3.5000908@redhat.com> Patchwork-id: 29442 O-Subject: [RHE5.6 PATCH] mpt2sas: Fix to use sas device list instead of enclosure list for _transpor_get_enclosure_identifier. Bugzilla: 652284 RH-Acked-by: David Milburn <dmilburn@redhat.com> RH-Acked-by: Ivan Vecera <ivecera@redhat.com> This is for bz#652284 Patch comes from LSI Upstream: http://marc.info/?l=linux-scsi&m=127676345328203&w=2 Enclosure_identifier not being returned by mpt2sas The driver exports callback function to the sas transport layer for obtaining the enclosure logical id. This function is called _transport_get_enclosure_identifier. The driver was searching the wrong list for the enclosure_identifier. The driver should be searching the sas device list instead of enclosure list. The sas address that is passed to the driver is for the end device, not enclosure. This patch already is in RHEL6, I've tested it on x64. Brew id = 2892358 Tomas Signed-off-by: Jarod Wilson <jarod@redhat.com> diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c index a0ce5ec..0bfcae7 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_transport.c +++ b/drivers/scsi/mpt2sas/mpt2sas_transport.c @@ -1004,18 +1004,18 @@ static int _transport_get_enclosure_identifier(struct sas_rphy *rphy, u64 *identifier) { struct MPT2SAS_ADAPTER *ioc = rphy_to_ioc(rphy); - struct _sas_node *sas_expander; + struct _sas_device *sas_device; unsigned long flags; - spin_lock_irqsave(&ioc->sas_node_lock, flags); - sas_expander = mpt2sas_scsih_expander_find_by_sas_address(ioc, + spin_lock_irqsave(&ioc->sas_device_lock, flags); + sas_device = mpt2sas_scsih_sas_device_find_by_sas_address(ioc, rphy->identify.sas_address); - spin_unlock_irqrestore(&ioc->sas_node_lock, flags); + spin_unlock_irqrestore(&ioc->sas_device_lock, flags); - if (!sas_expander) + if (!sas_device) return -ENXIO; - *identifier = sas_expander->enclosure_logical_id; + *identifier = sas_device->enclosure_logical_id; return 0; }