diff options
author | Darrick J. Wong <djwong@us.ibm.com> | 2007-01-11 17:14:52 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-01-13 15:24:25 -0500 |
commit | bf451207511d049189ddb0a4eae3acdb086a3c82 (patch) | |
tree | 6866bb955a2e61a68cf791afc32497b24dd306c0 /drivers/scsi/libsas | |
parent | 8880839815265ccc0edaff52ba08d750eea57acb (diff) |
[SCSI] libsas: Clean up rphys/port dev list after a discovery error on an expander
sas_get_port_device assigns a rphy to a domain device in anticipation
of finding a disk. When a discovery error occurs in
sas_discover_{sata,sas,expander}*, however, we need to clean up that
rphy and the port device list so that we don't GPF. In addition, we
need to check the result of the second sas_notify_lldd_dev_found.
This patch seems ok on a x260, x366 and x206m.
This patch fixes up sas_expander.c separately because jejb has some
cleanup patches of his own that are a prerequisite.
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/libsas')
-rw-r--r-- | drivers/scsi/libsas/sas_expander.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index d31e6fa466f7..0dfd97e7e96c 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
@@ -668,7 +668,6 @@ static struct domain_device *sas_ex_discover_end_dev( | |||
668 | 668 | ||
669 | out_list_del: | 669 | out_list_del: |
670 | list_del(&child->dev_list_node); | 670 | list_del(&child->dev_list_node); |
671 | sas_rphy_free(rphy); | ||
672 | out_free: | 671 | out_free: |
673 | sas_port_delete(phy->port); | 672 | sas_port_delete(phy->port); |
674 | out_err: | 673 | out_err: |
@@ -1431,14 +1430,27 @@ int sas_discover_root_expander(struct domain_device *dev) | |||
1431 | int res; | 1430 | int res; |
1432 | struct sas_expander_device *ex = rphy_to_expander_device(dev->rphy); | 1431 | struct sas_expander_device *ex = rphy_to_expander_device(dev->rphy); |
1433 | 1432 | ||
1434 | sas_rphy_add(dev->rphy); | 1433 | res = sas_rphy_add(dev->rphy); |
1434 | if (res) | ||
1435 | goto out_err; | ||
1435 | 1436 | ||
1436 | ex->level = dev->port->disc.max_level; /* 0 */ | 1437 | ex->level = dev->port->disc.max_level; /* 0 */ |
1437 | res = sas_discover_expander(dev); | 1438 | res = sas_discover_expander(dev); |
1438 | if (!res) | 1439 | if (res) |
1439 | sas_ex_bfs_disc(dev->port); | 1440 | goto out_err2; |
1441 | |||
1442 | sas_ex_bfs_disc(dev->port); | ||
1440 | 1443 | ||
1441 | return res; | 1444 | return res; |
1445 | |||
1446 | out_err2: | ||
1447 | sas_rphy_delete(dev->rphy); | ||
1448 | dev->rphy = NULL; | ||
1449 | return res; | ||
1450 | out_err: | ||
1451 | sas_rphy_free(dev->rphy); | ||
1452 | dev->rphy = NULL; | ||
1453 | return res; | ||
1442 | } | 1454 | } |
1443 | 1455 | ||
1444 | /* ---------- Domain revalidation ---------- */ | 1456 | /* ---------- Domain revalidation ---------- */ |