[SCSI] libsas, libata: fix start of life for a sas ata_port
This changes the ordering of initialization and probing events from: 1/ allocate rphy in PORTE_BYTES_DMAED, DISCE_REVALIDATE_DOMAIN 2/ allocate ata_port and schedule port probe in DISCE_PROBE ...to: 1/ allocate ata_port in PORTE_BYTES_DMAED, DISCE_REVALIDATE_DOMAIN 2/ allocate rphy in PORTE_BYTES_DMAED, DISCE_REVALIDATE_DOMAIN 3/ schedule port probe in DISCE_PROBE This ordering prevents PHYE_SIGNAL_LOSS_EVENTS from sneaking in to destrory ata devices before they have been fully initialized: BUG: unable to handle kernel paging request at 0000000000003b10 IP: [<ffffffffa0053d7e>] sas_ata_end_eh+0x12/0x5e [libsas] ... [<ffffffffa004d1af>] sas_unregister_common_dev+0x78/0xc9 [libsas] [<ffffffffa004d4d4>] sas_unregister_dev+0x4f/0xad [libsas] [<ffffffffa004d5b1>] sas_unregister_domain_devices+0x7f/0xbf [libsas] [<ffffffffa004c487>] sas_deform_port+0x61/0x1b8 [libsas] [<ffffffffa004bed0>] sas_phye_loss_of_signal+0x29/0x2b [libsas] ...and kills the awkward "sata domain_device briefly existing in the domain without an ata_port" state. Reported-by: Michal Kosciowski <michal.kosciowski@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Acked-by: Jeff Garzik <jgarzik@redhat.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
This commit is contained in:

committed by
James Bottomley

parent
0f3fce5cc7
commit
b202445925
@@ -72,6 +72,7 @@ static int sas_get_port_device(struct asd_sas_port *port)
|
||||
struct asd_sas_phy *phy;
|
||||
struct sas_rphy *rphy;
|
||||
struct domain_device *dev;
|
||||
int rc = -ENODEV;
|
||||
|
||||
dev = sas_alloc_device();
|
||||
if (!dev)
|
||||
@@ -110,9 +111,16 @@ static int sas_get_port_device(struct asd_sas_port *port)
|
||||
|
||||
sas_init_dev(dev);
|
||||
|
||||
dev->port = port;
|
||||
switch (dev->dev_type) {
|
||||
case SAS_END_DEV:
|
||||
case SATA_DEV:
|
||||
rc = sas_ata_init(dev);
|
||||
if (rc) {
|
||||
rphy = NULL;
|
||||
break;
|
||||
}
|
||||
/* fall through */
|
||||
case SAS_END_DEV:
|
||||
rphy = sas_end_device_alloc(port->port);
|
||||
break;
|
||||
case EDGE_DEV:
|
||||
@@ -131,7 +139,7 @@ static int sas_get_port_device(struct asd_sas_port *port)
|
||||
|
||||
if (!rphy) {
|
||||
sas_put_device(dev);
|
||||
return -ENODEV;
|
||||
return rc;
|
||||
}
|
||||
|
||||
rphy->identify.phy_identifier = phy->phy->identify.phy_identifier;
|
||||
@@ -139,7 +147,6 @@ static int sas_get_port_device(struct asd_sas_port *port)
|
||||
sas_fill_in_rphy(dev, rphy);
|
||||
sas_hash_addr(dev->hashed_sas_addr, dev->sas_addr);
|
||||
port->port_dev = dev;
|
||||
dev->port = port;
|
||||
dev->linkrate = port->linkrate;
|
||||
dev->min_linkrate = port->linkrate;
|
||||
dev->max_linkrate = port->linkrate;
|
||||
|
Reference in New Issue
Block a user