aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsas
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-22 20:34:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-22 20:34:15 -0400
commitc70b5296e775cde46cfcb2d860ba160108a5ec7a (patch)
tree30419cb982acca44499236adcca65f2f87698c74 /drivers/scsi/libsas
parent80c226fbef56576946c9655fcb2ab62e63404d12 (diff)
parent58ff4bd042adf8013c8f70fd03c2c0f8d022e387 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (84 commits) [SCSI] be2iscsi: SGE Len == 64K [SCSI] be2iscsi: Remove premature free of cid [SCSI] be2iscsi: More time for FW [SCSI] libsas: fix bug for vacant phy [SCSI] sd: Fix overflow with big physical blocks [SCSI] st: add MTWEOFI to write filemarks without flushing drive buffer [SCSI] libsas: Don't issue commands to devices that have been hot-removed [SCSI] megaraid_sas: Add Online Controller Reset to MegaRAID SAS drive [SCSI] lpfc 8.3.17: Update lpfc driver version to 8.3.17 [SCSI] lpfc 8.3.17: Replace function reset methodology [SCSI] lpfc 8.3.17: SCSI fixes [SCSI] lpfc 8.3.17: BSG fixes [SCSI] lpfc 8.3.17: SLI Additions and Fixes [SCSI] lpfc 8.3.17: Code Cleanup and Locking fixes [SCSI] zfcp: Remove scsi_cmnd->serial_number from debug traces [SCSI] ipr: fix array error logging [SCSI] aha152x: enable PCMCIA on 64bit [SCSI] scsi_dh_alua: Handle all states correctly [SCSI] cxgb4i: connection and ddp setting update [SCSI] cxgb3i: fixed connection over vlan ...
Diffstat (limited to 'drivers/scsi/libsas')
-rw-r--r--drivers/scsi/libsas/sas_ata.c5
-rw-r--r--drivers/scsi/libsas/sas_expander.c12
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c7
3 files changed, 21 insertions, 3 deletions
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 042153cbbde1..e1a395b438ee 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -162,6 +162,10 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
162 unsigned int xfer = 0; 162 unsigned int xfer = 0;
163 unsigned int si; 163 unsigned int si;
164 164
165 /* If the device fell off, no sense in issuing commands */
166 if (dev->gone)
167 return AC_ERR_SYSTEM;
168
165 task = sas_alloc_task(GFP_ATOMIC); 169 task = sas_alloc_task(GFP_ATOMIC);
166 if (!task) 170 if (!task)
167 return AC_ERR_SYSTEM; 171 return AC_ERR_SYSTEM;
@@ -347,6 +351,7 @@ static int sas_ata_scr_read(struct ata_link *link, unsigned int sc_reg_in,
347static struct ata_port_operations sas_sata_ops = { 351static struct ata_port_operations sas_sata_ops = {
348 .phy_reset = sas_ata_phy_reset, 352 .phy_reset = sas_ata_phy_reset,
349 .post_internal_cmd = sas_ata_post_internal, 353 .post_internal_cmd = sas_ata_post_internal,
354 .qc_defer = ata_std_qc_defer,
350 .qc_prep = ata_noop_qc_prep, 355 .qc_prep = ata_noop_qc_prep,
351 .qc_issue = sas_ata_qc_issue, 356 .qc_issue = sas_ata_qc_issue,
352 .qc_fill_rtf = sas_ata_qc_fill_rtf, 357 .qc_fill_rtf = sas_ata_qc_fill_rtf,
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index 83dd5070a15c..505ffe358293 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -175,10 +175,10 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id,
175 switch (resp->result) { 175 switch (resp->result) {
176 case SMP_RESP_PHY_VACANT: 176 case SMP_RESP_PHY_VACANT:
177 phy->phy_state = PHY_VACANT; 177 phy->phy_state = PHY_VACANT;
178 return; 178 break;
179 default: 179 default:
180 phy->phy_state = PHY_NOT_PRESENT; 180 phy->phy_state = PHY_NOT_PRESENT;
181 return; 181 break;
182 case SMP_RESP_FUNC_ACC: 182 case SMP_RESP_FUNC_ACC:
183 phy->phy_state = PHY_EMPTY; /* do not know yet */ 183 phy->phy_state = PHY_EMPTY; /* do not know yet */
184 break; 184 break;
@@ -209,7 +209,10 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id,
209 phy->phy->negotiated_linkrate = phy->linkrate; 209 phy->phy->negotiated_linkrate = phy->linkrate;
210 210
211 if (!rediscover) 211 if (!rediscover)
212 sas_phy_add(phy->phy); 212 if (sas_phy_add(phy->phy)) {
213 sas_phy_free(phy->phy);
214 return;
215 }
213 216
214 SAS_DPRINTK("ex %016llx phy%02d:%c attached: %016llx\n", 217 SAS_DPRINTK("ex %016llx phy%02d:%c attached: %016llx\n",
215 SAS_ADDR(dev->sas_addr), phy->phy_id, 218 SAS_ADDR(dev->sas_addr), phy->phy_id,
@@ -1724,6 +1727,7 @@ static void sas_unregister_ex_tree(struct domain_device *dev)
1724 struct domain_device *child, *n; 1727 struct domain_device *child, *n;
1725 1728
1726 list_for_each_entry_safe(child, n, &ex->children, siblings) { 1729 list_for_each_entry_safe(child, n, &ex->children, siblings) {
1730 child->gone = 1;
1727 if (child->dev_type == EDGE_DEV || 1731 if (child->dev_type == EDGE_DEV ||
1728 child->dev_type == FANOUT_DEV) 1732 child->dev_type == FANOUT_DEV)
1729 sas_unregister_ex_tree(child); 1733 sas_unregister_ex_tree(child);
@@ -1744,6 +1748,7 @@ static void sas_unregister_devs_sas_addr(struct domain_device *parent,
1744 &ex_dev->children, siblings) { 1748 &ex_dev->children, siblings) {
1745 if (SAS_ADDR(child->sas_addr) == 1749 if (SAS_ADDR(child->sas_addr) ==
1746 SAS_ADDR(phy->attached_sas_addr)) { 1750 SAS_ADDR(phy->attached_sas_addr)) {
1751 child->gone = 1;
1747 if (child->dev_type == EDGE_DEV || 1752 if (child->dev_type == EDGE_DEV ||
1748 child->dev_type == FANOUT_DEV) 1753 child->dev_type == FANOUT_DEV)
1749 sas_unregister_ex_tree(child); 1754 sas_unregister_ex_tree(child);
@@ -1752,6 +1757,7 @@ static void sas_unregister_devs_sas_addr(struct domain_device *parent,
1752 break; 1757 break;
1753 } 1758 }
1754 } 1759 }
1760 parent->gone = 1;
1755 sas_disable_routing(parent, phy->attached_sas_addr); 1761 sas_disable_routing(parent, phy->attached_sas_addr);
1756 } 1762 }
1757 memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE); 1763 memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE);
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 535085cd27ec..55f09e92ab59 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -217,6 +217,13 @@ int sas_queuecommand(struct scsi_cmnd *cmd,
217 goto out; 217 goto out;
218 } 218 }
219 219
220 /* If the device fell off, no sense in issuing commands */
221 if (dev->gone) {
222 cmd->result = DID_BAD_TARGET << 16;
223 scsi_done(cmd);
224 goto out;
225 }
226
220 res = -ENOMEM; 227 res = -ENOMEM;
221 task = sas_create_task(cmd, dev, GFP_ATOMIC); 228 task = sas_create_task(cmd, dev, GFP_ATOMIC);
222 if (!task) 229 if (!task)