summaryrefslogtreecommitdiff
path: root/drivers/scsi/libsas/sas_expander.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@us.ibm.com>2010-10-01 13:55:47 -0700
committerJames Bottomley <James.Bottomley@suse.de>2010-10-08 16:03:42 -0500
commit56dd2c0691a5a387b7b05835fe547dc6fade9407 (patch)
treed7ff3abef5b42f554128b30072aaa1e2aa7eab08 /drivers/scsi/libsas/sas_expander.c
parent39a985547cbfcbb0b23667b69b8ae82a6cf312ac (diff)
[SCSI] libsas: Don't issue commands to devices that have been hot-removed
sd will get hung up issuing commands to flush write cache if a SAS device behind the expander is unplugged without warning. Change libsas to reject commands to domain devices that have already gone away. [maciej.trela@intel.com: removed setting ->gone in sas_deform_port() to permit sync cache commands at module removal] Signed-off-by: Darrick J. Wong <djwong@us.ibm.com> Tested-by: Haipao Fan <haipao.fan@intel.com> Signed-off-by: Maciej Trela <maciej.trela@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/libsas/sas_expander.c')
-rw-r--r--drivers/scsi/libsas/sas_expander.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index 83dd5070a15c..61d81f858a5a 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -1724,6 +1724,7 @@ static void sas_unregister_ex_tree(struct domain_device *dev)
struct domain_device *child, *n;
list_for_each_entry_safe(child, n, &ex->children, siblings) {
+ child->gone = 1;
if (child->dev_type == EDGE_DEV ||
child->dev_type == FANOUT_DEV)
sas_unregister_ex_tree(child);
@@ -1744,6 +1745,7 @@ static void sas_unregister_devs_sas_addr(struct domain_device *parent,
&ex_dev->children, siblings) {
if (SAS_ADDR(child->sas_addr) ==
SAS_ADDR(phy->attached_sas_addr)) {
+ child->gone = 1;
if (child->dev_type == EDGE_DEV ||
child->dev_type == FANOUT_DEV)
sas_unregister_ex_tree(child);
@@ -1752,6 +1754,7 @@ static void sas_unregister_devs_sas_addr(struct domain_device *parent,
break;
}
}
+ parent->gone = 1;
sas_disable_routing(parent, phy->attached_sas_addr);
}
memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE);