lkml.org 
[lkml]   [2022]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] scsi: libsas: Grab the host lock in sas_ata_device_link_abort()
From
On 2022/12/20 23:59, John Garry wrote:
> On 20/12/2022 12:53, Xingui Yang wrote:
>> Grab the host lock in sas_ata_device_link_abort() before calling
>
> This is should be the ata port lock, right? I know that the ata comments
> say differently.
>
>> ata_link_abort(), as the comment in ata_link_abort() mentions.
>>
>
> Can you please add a fixes tag?
>
>> Signed-off-by: Xingui Yang <yangxingui@huawei.com>
>
> Reviewed-by: John Garry <john.g.garry@oracle.com>
>
>> ---
>> drivers/scsi/libsas/sas_ata.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
>> index f7439bf9cdc6..4f2017b21e6d 100644
>> --- a/drivers/scsi/libsas/sas_ata.c
>> +++ b/drivers/scsi/libsas/sas_ata.c
>> @@ -889,7 +889,9 @@ void sas_ata_device_link_abort(struct domain_device *device, bool force_reset)
>> {
>> struct ata_port *ap = device->sata_dev.ap;
>> struct ata_link *link = &ap->link;
>> + unsigned long flags;
>>
>> + spin_lock_irqsave(ap->lock, flags);
>> device->sata_dev.fis[2] = ATA_ERR | ATA_DRDY; /* tf status */
>> device->sata_dev.fis[3] = ATA_ABORTED; /* tf error */
>>
>> @@ -897,6 +899,7 @@ void sas_ata_device_link_abort(struct domain_device *device, bool force_reset)
>> if (force_reset)
>> link->eh_info.action |= ATA_EH_RESET;
>> ata_link_abort(link);

Really need to add lockdep annotations in libata to avoid/catch such bugs...
Will work on that.

>> + spin_unlock_irqrestore(ap->lock, flags);
>> }
>> EXPORT_SYMBOL_GPL(sas_ata_device_link_abort);
>>
>

--
Damien Le Moal
Western Digital Research

\
 
 \ /
  Last update: 2023-03-26 23:16    [W:0.086 / U:0.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site