Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bf451207511d049189ddb0a4eae3acdb086a3c82
Commit:     bf451207511d049189ddb0a4eae3acdb086a3c82
Parent:     8880839815265ccc0edaff52ba08d750eea57acb
Author:     Darrick J. Wong <[EMAIL PROTECTED]>
AuthorDate: Thu Jan 11 14:14:52 2007 -0800
Committer:  James Bottomley <[EMAIL PROTECTED]>
CommitDate: Sat Jan 13 14:24:25 2007 -0600

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: James Bottomley <[EMAIL PROTECTED]>
---
 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 d31e6fa..0dfd97e 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(
 
  out_list_del:
        list_del(&child->dev_list_node);
-       sas_rphy_free(rphy);
  out_free:
        sas_port_delete(phy->port);
  out_err:
@@ -1431,14 +1430,27 @@ int sas_discover_root_expander(struct domain_device 
*dev)
        int res;
        struct sas_expander_device *ex = rphy_to_expander_device(dev->rphy);
 
-       sas_rphy_add(dev->rphy);
+       res = sas_rphy_add(dev->rphy);
+       if (res)
+               goto out_err;
 
        ex->level = dev->port->disc.max_level; /* 0 */
        res = sas_discover_expander(dev);
-       if (!res)
-               sas_ex_bfs_disc(dev->port);
+       if (res)
+               goto out_err2;
+
+       sas_ex_bfs_disc(dev->port);
 
        return res;
+
+out_err2:
+       sas_rphy_delete(dev->rphy);
+       dev->rphy = NULL;
+       return res;
+out_err:
+       sas_rphy_free(dev->rphy);
+       dev->rphy = NULL;
+       return res;
 }
 
 /* ---------- Domain revalidation ---------- */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to