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

    [SCSI] libsas: Clean up rphys/port dev list after a discovery error.
    
    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.
    
    Signed-off-by: Darrick J. Wong <[EMAIL PROTECTED]>
    Signed-off-by: James Bottomley <[EMAIL PROTECTED]>
---
 drivers/scsi/libsas/sas_discover.c |   39 ++++++++++++++++++++++++++++++-----
 1 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/libsas/sas_discover.c 
b/drivers/scsi/libsas/sas_discover.c
index fb7df7b..21f538e 100644
--- a/drivers/scsi/libsas/sas_discover.c
+++ b/drivers/scsi/libsas/sas_discover.c
@@ -548,7 +548,7 @@ int sas_discover_sata(struct domain_device *dev)
 
        res = sas_notify_lldd_dev_found(dev);
        if (res)
-               return res;
+               goto out_err2;
 
        switch (dev->dev_type) {
        case SATA_DEV:
@@ -560,11 +560,25 @@ int sas_discover_sata(struct domain_device *dev)
        default:
                break;
        }
+       if (res)
+               goto out_err;
 
        sas_notify_lldd_dev_gone(dev);
-       if (!res) {
-               sas_notify_lldd_dev_found(dev);
-       }
+       res = sas_notify_lldd_dev_found(dev);
+       if (res)
+               goto out_err2;
+
+       res = sas_rphy_add(dev->rphy);
+       if (res)
+               goto out_err;
+
+       return res;
+
+out_err:
+       sas_notify_lldd_dev_gone(dev);
+out_err2:
+       sas_rphy_free(dev->rphy);
+       dev->rphy = NULL;
        return res;
 }
 
@@ -580,7 +594,7 @@ int sas_discover_end_dev(struct domain_device *dev)
 
        res = sas_notify_lldd_dev_found(dev);
        if (res)
-               return res;
+               goto out_err2;
 
        res = sas_rphy_add(dev->rphy);
        if (res)
@@ -589,12 +603,21 @@ int sas_discover_end_dev(struct domain_device *dev)
        /* do this to get the end device port attributes which will have
         * been scanned in sas_rphy_add */
        sas_notify_lldd_dev_gone(dev);
-       sas_notify_lldd_dev_found(dev);
+       res = sas_notify_lldd_dev_found(dev);
+       if (res)
+               goto out_err3;
 
        return 0;
 
 out_err:
        sas_notify_lldd_dev_gone(dev);
+out_err2:
+       sas_rphy_free(dev->rphy);
+       dev->rphy = NULL;
+       return res;
+out_err3:
+       sas_rphy_delete(dev->rphy);
+       dev->rphy = NULL;
        return res;
 }
 
@@ -686,6 +709,10 @@ static void sas_discover_domain(struct work_struct *work)
        }
 
        if (error) {
+               spin_lock(&port->dev_list_lock);
+               list_del_init(&port->port_dev->dev_list_node);
+               spin_unlock(&port->dev_list_lock);
+
                kfree(port->port_dev); /* not kobject_register-ed yet */
                port->port_dev = NULL;
        }
-
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