aic94xx: fix sleep under lock
PATCH 1/1 aic94xx: fix sleep under lock
Lockdep didn't pick this one up for me, sigh ...
But I noticed the port_alloc/port_add functions are called with locks held. Since these may potentially sleep, this is a no-no. Correct by moving the calls to outside the locked region.
James
drivers/scsi/sas/sas_port.c +7 -7
@@ -82,13 +82,6 @@return ; } -if (!port->port) { - port->port =sas_port_alloc (phy->phy->dev.parent, port->id); -BUG_ON (!port->port); -sas_port_add (port->port); - } -sas_port_add_phy (port->port, phy->phy); -/* add the phy to the port */ list_add_tail (&phy->port_phy_el, &port->phy_list); phy->port = port;
@@ -114,6 +107,13 @@spin_unlock (&port->phy_list_lock);spin_unlock (&sas_ha->phy_port_lock); +if (!port->port) { + port->port =sas_port_alloc (phy->phy->dev.parent, port->id); +BUG_ON (!port->port); +sas_port_add (port->port); + } +sas_port_add_phy (port->port, phy->phy); +if (port->port_dev) port->port_dev->pathways = port->num_phys;