[SCSI] libsas: mark all domain devices gone if root port disappears
authorDan Williams <dan.j.williams@intel.com>
Tue, 10 Jan 2012 22:39:13 +0000 (14:39 -0800)
committerJames Bottomley <JBottomley@Parallels.com>
Wed, 29 Feb 2012 21:20:55 +0000 (15:20 -0600)
If the top level expander is hot removed, mark all child devices as gone
before unregistration to short circuit futile recovery.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/libsas/sas_discover.c
drivers/scsi/libsas/sas_port.c
include/scsi/libsas.h

index 789b50861bb9aeedbf8856fb094abbc5420226a9..b91866a8233bae0e2a1d5ae0d9a6afe42de29ea6 100644 (file)
@@ -299,12 +299,16 @@ void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *dev)
        }
 }
 
-void sas_unregister_domain_devices(struct asd_sas_port *port)
+void sas_unregister_domain_devices(struct asd_sas_port *port, int gone)
 {
        struct domain_device *dev, *n;
 
-       list_for_each_entry_safe_reverse(dev, n, &port->dev_list, dev_list_node)
+       list_for_each_entry_safe_reverse(dev, n, &port->dev_list, dev_list_node) {
+               if (gone)
+                       set_bit(SAS_DEV_GONE, &dev->state);
                sas_unregister_dev(port, dev);
+       }
+
        list_for_each_entry_safe(dev, n, &port->disco_list, disco_list_node)
                sas_unregister_dev(port, dev);
 
index 31adcd1b41914a87ba0be751eabdc920727cbff2..59ee8a0a6ea958aaf0026336fdcb717d285aafee 100644 (file)
@@ -167,9 +167,7 @@ void sas_deform_port(struct asd_sas_phy *phy, int gone)
                dev->pathways--;
 
        if (port->num_phys == 1) {
-               if (dev && gone)
-                       set_bit(SAS_DEV_GONE, &dev->state);
-               sas_unregister_domain_devices(port);
+               sas_unregister_domain_devices(port, gone);
                sas_port_delete(port->port);
                port->port = NULL;
        } else {
index 55bab86338079c6d6534e6de59b4e6e29c521b75..4a42be34fad086b03e18bc1352352aae2124c5ba 100644 (file)
@@ -664,7 +664,7 @@ void sas_init_ex_attr(void);
 
 int  sas_ex_revalidate_domain(struct domain_device *);
 
-void sas_unregister_domain_devices(struct asd_sas_port *port);
+void sas_unregister_domain_devices(struct asd_sas_port *port, int gone);
 void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *);
 int  sas_discover_event(struct asd_sas_port *, enum discover_event ev);