Re: [PATCH v3 03/14] libsas: prevent domain rediscovery competing with ata error handling

Dan Williams
2012-01-09T20:03:17Z

On Mon, Jan 9, 2012 at 11:14 AM, Dan Williams <dan.j.williams@intel.com> wrote:
> On Thu, Jan 5, 2012 at 4:59 PM, Dan Williams <dan.j.williams@intel.com> wrote:
>> +void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *dev)
>> +{
>> +       if (!list_empty(&dev->disco_list_node)) {
>> +               /* this rphy never saw sas_rphy_add */
>> +               list_del_init(&dev->disco_list_node);
>> +               sas_rphy_free(dev->rphy);
>> +               dev->rphy = NULL;
>> +               sas_unregister_common_dev(port, dev);
>> +       }
>> +
>> +       if (dev->rphy) {
>> +               sas_rphy_unlink(dev->rphy);
>> +
>> +               spin_lock_irq(&port->dev_list_lock);
>> +               list_move_tail(&dev->dev_list_node, &port->destroy_list);
>> +               spin_unlock_irq(&port->dev_list_lock);
>
> This is too early to make the device appear removed from the domain.
> Will revise the patch to re-use disco_list_node to for
> port->destroy_list.

...we also need to clear the parent sas_port's rphy reference to get
sas_port_delete to skip its call to sas_rphy_delete and leave it to
the DISCE_DESTRUCT event.