Skip to content

Commit

Permalink
[SCSI] libsas: mark all domain devices gone if root port disappears
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Williams authored and James Bottomley committed Feb 29, 2012
1 parent 45c73b6 commit 7d05919
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 6 additions & 2 deletions drivers/scsi/libsas/sas_discover.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 1 addition & 3 deletions drivers/scsi/libsas/sas_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion include/scsi/libsas.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 7d05919

Please sign in to comment.