Re: [PATCH 4/6] scsi: libsas: remove useless dev_list delete in sas_ex_discover_end_dev()

Jason Yan
2022-12-08T07:21:27Z

On 2022/12/5 17:14, John Garry wrote:
> On 04/12/2022 08:16, Jason Yan wrote:
>> The domain device 'child' is allocated in sas_ex_discover_end_dev() and
>> never been added to dev_list. So remove the useless list_del() and
>> related locks.
>>
>> Cc: John Garry <john.g.garry@oracle.com>
>> Signed-off-by: Jason Yan <yanaijie@huawei.com>
>> ---
>>   drivers/scsi/libsas/sas_expander.c | 3 ---
>>   1 file changed, 3 deletions(-)
>>
>> diff --git a/drivers/scsi/libsas/sas_expander.c
>> b/drivers/scsi/libsas/sas_expander.c
>> index a8af723fab3c..82ea7560a888 100644
>> --- a/drivers/scsi/libsas/sas_expander.c
>> +++ b/drivers/scsi/libsas/sas_expander.c
>> @@ -875,9 +875,6 @@ static struct domain_device *sas_ex_discover_end_dev(
>>    out_list_del:
>>       sas_rphy_free(child->rphy);
>>       list_del(&child->disco_list_node);
>> -    spin_lock_irq(&parent->port->dev_list_lock);
>> -    list_del(&child->dev_list_node);
>> -    spin_unlock_irq(&parent->port->dev_list_lock);
>
> Since we have the spin lock'ing, this seems to be have been
> intentionally added (and not some simple typo or similar) - any idea of
> the origin?

The new device used to be added to the dev_list in this function. But
after 92625f9bff38 ("[SCSI] libsas: restore scan order") and
87c8331fcf72 ("[SCSI] libsas: prevent domain rediscovery competing with
ata error handling") it is added to the disco_list instead. But the
list_del() and locking is forgot to be removed.

Thanks,
Jason