diff options
author | Dan Williams <dan.j.williams@intel.com> | 2012-03-20 13:50:27 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-05-07 11:56:37 -0400 |
commit | cfea9a253443f5b02ea1e0f9667e6cf987069f9b (patch) | |
tree | bc895b0177c557b668a2e1f66e7925fcdfe1b4a5 /drivers/scsi | |
parent | 0c5f01a4e19099d740d85ea63e2605aa705cdd9e (diff) |
SCSI: libsas: fix false positive 'device attached' conditions
commit 7d1d865181185bdf1316d236b1b4bd02c9020729 upstream.
Normalize phy->attached_sas_addr to return a zero-address in the case
when device-type == NO_DEVICE or the linkrate is invalid to handle
expanders that put non-zero sas addresses in the discovery response:
sas: ex 5001b4da000f903f phy02:U:0 attached: 0100000000000000 (no device)
sas: ex 5001b4da000f903f phy01:U:0 attached: 0100000000000000 (no device)
sas: ex 5001b4da000f903f phy03:U:0 attached: 0100000000000000 (no device)
sas: ex 5001b4da000f903f phy00:U:0 attached: 0100000000000000 (no device)
Reported-by: Andrzej Jakowski <andrzej.jakowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/libsas/sas_expander.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 3ca60875b3e..e68fac69504 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
@@ -192,7 +192,14 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, | |||
192 | phy->attached_sata_ps = dr->attached_sata_ps; | 192 | phy->attached_sata_ps = dr->attached_sata_ps; |
193 | phy->attached_iproto = dr->iproto << 1; | 193 | phy->attached_iproto = dr->iproto << 1; |
194 | phy->attached_tproto = dr->tproto << 1; | 194 | phy->attached_tproto = dr->tproto << 1; |
195 | memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE); | 195 | /* help some expanders that fail to zero sas_address in the 'no |
196 | * device' case | ||
197 | */ | ||
198 | if (phy->attached_dev_type == NO_DEVICE || | ||
199 | phy->linkrate < SAS_LINK_RATE_1_5_GBPS) | ||
200 | memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE); | ||
201 | else | ||
202 | memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE); | ||
196 | phy->attached_phy_id = dr->attached_phy_id; | 203 | phy->attached_phy_id = dr->attached_phy_id; |
197 | phy->phy_change_count = dr->change_count; | 204 | phy->phy_change_count = dr->change_count; |
198 | phy->routing_attr = dr->routing_attr; | 205 | phy->routing_attr = dr->routing_attr; |