diff mbox series

[4/5] scsi: libsas: check the ata device status by ata_dev_enabled()

Message ID 20180912082946.34814-5-yanaijie@huawei.com (mailing list archive)
State Superseded
Headers show
Series scsi: libsas: some code cleanups and bug fixes | expand

Commit Message

Jason Yan Sept. 12, 2018, 8:29 a.m. UTC
When ata device IDENTIFY failed, the ata device status is
ATA_DEV_UNKNOWN. The libata reported like:

[113518.620433] ata5.00: qc timeout (cmd 0xec)
[113518.653646] ata5.00: failed to IDENTIFY (I/O error, err_mask=0x4)

But libsas verifies the device status by ata_dev_disabled(), which
skiped ATA_DEV_UNKNOWN. This will make libsas think the ata device
probing succeed the device cannot be actually brought up. And even the
new bcast of this device will be considered as flutter and will not
probe this device again.

Change ata_dev_disabled() to !ata_dev_enabled() so that libsas can
deal with this if the ata device probe failed. New bcasts can let us
try to probe the device again and bring it up if it is fine to
IDENTIFY.

Tested-by: Zhou Yupeng <zhouyupeng1@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
CC: John Garry <john.garry@huawei.com>
CC: Johannes Thumshirn <jthumshirn@suse.de>
CC: Ewan Milne <emilne@redhat.com>
CC: Christoph Hellwig <hch@lst.de>
CC: Tomas Henzl <thenzl@redhat.com>
CC: Dan Williams <dan.j.williams@intel.com>
CC: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/libsas/sas_ata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Hannes Reinecke Sept. 17, 2018, 1:56 p.m. UTC | #1
On 09/12/2018 10:29 AM, Jason Yan wrote:
> When ata device IDENTIFY failed, the ata device status is
> ATA_DEV_UNKNOWN. The libata reported like:
> 
> [113518.620433] ata5.00: qc timeout (cmd 0xec)
> [113518.653646] ata5.00: failed to IDENTIFY (I/O error, err_mask=0x4)
> 
> But libsas verifies the device status by ata_dev_disabled(), which
> skiped ATA_DEV_UNKNOWN. This will make libsas think the ata device
> probing succeed the device cannot be actually brought up. And even the
> new bcast of this device will be considered as flutter and will not
> probe this device again.
> 
> Change ata_dev_disabled() to !ata_dev_enabled() so that libsas can
> deal with this if the ata device probe failed. New bcasts can let us
> try to probe the device again and bring it up if it is fine to
> IDENTIFY.
> 
> Tested-by: Zhou Yupeng <zhouyupeng1@huawei.com>
> Signed-off-by: Jason Yan <yanaijie@huawei.com>
> CC: John Garry <john.garry@huawei.com>
> CC: Johannes Thumshirn <jthumshirn@suse.de>
> CC: Ewan Milne <emilne@redhat.com>
> CC: Christoph Hellwig <hch@lst.de>
> CC: Tomas Henzl <thenzl@redhat.com>
> CC: Dan Williams <dan.j.williams@intel.com>
> CC: Hannes Reinecke <hare@suse.com>
> ---
>  drivers/scsi/libsas/sas_ata.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
> index 64a958a99f6a..4f6cdf53e913 100644
> --- a/drivers/scsi/libsas/sas_ata.c
> +++ b/drivers/scsi/libsas/sas_ata.c
> @@ -654,7 +654,7 @@ void sas_probe_sata(struct asd_sas_port *port)
>  		/* if libata could not bring the link up, don't surface
>  		 * the device
>  		 */
> -		if (ata_dev_disabled(sas_to_ata_dev(dev)))
> +		if (!ata_dev_enabled(sas_to_ata_dev(dev)))
>  			sas_fail_probe(dev, __func__, -ENODEV);
>  	}
>  
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
John Garry Sept. 18, 2018, 1:54 p.m. UTC | #2
+

On 12/09/2018 09:29, Jason Yan wrote:
> When ata device IDENTIFY failed, the ata device status is
> ATA_DEV_UNKNOWN. The libata reported like:
>
> [113518.620433] ata5.00: qc timeout (cmd 0xec)
> [113518.653646] ata5.00: failed to IDENTIFY (I/O error, err_mask=0x4)
>
> But libsas verifies the device status by ata_dev_disabled(), which
> skiped ATA_DEV_UNKNOWN. This will make libsas think the ata device

/s/skiped/skipped/

> probing succeed the device cannot be actually brought up. And even the
> new bcast of this device will be considered as flutter and will not
> probe this device again.
>
> Change ata_dev_disabled() to !ata_dev_enabled() so that libsas can
> deal with this if the ata device probe failed. New bcasts can let us
> try to probe the device again and bring it up if it is fine to
> IDENTIFY.
>
> Tested-by: Zhou Yupeng <zhouyupeng1@huawei.com>
> Signed-off-by: Jason Yan <yanaijie@huawei.com>

Reviewed-by: John Garry <john.garry@huawei.com>

> CC: John Garry <john.garry@huawei.com>
> CC: Johannes Thumshirn <jthumshirn@suse.de>
> CC: Ewan Milne <emilne@redhat.com>
> CC: Christoph Hellwig <hch@lst.de>
> CC: Tomas Henzl <thenzl@redhat.com>
> CC: Dan Williams <dan.j.williams@intel.com>
> CC: Hannes Reinecke <hare@suse.com>
> ---
>  drivers/scsi/libsas/sas_ata.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
> index 64a958a99f6a..4f6cdf53e913 100644
> --- a/drivers/scsi/libsas/sas_ata.c
> +++ b/drivers/scsi/libsas/sas_ata.c
> @@ -654,7 +654,7 @@ void sas_probe_sata(struct asd_sas_port *port)
>  		/* if libata could not bring the link up, don't surface
>  		 * the device
>  		 */
> -		if (ata_dev_disabled(sas_to_ata_dev(dev)))
> +		if (!ata_dev_enabled(sas_to_ata_dev(dev)))

I do wonder if ata_dev_disabled() needs to be updated to cover 
ATA_DEV_UNKNOWN also or even instead of this change?

>  			sas_fail_probe(dev, __func__, -ENODEV);
>  	}
>
>
Jason Yan Sept. 19, 2018, 2:54 a.m. UTC | #3
On 2018/9/18 21:54, John Garry wrote:
> +
>
> On 12/09/2018 09:29, Jason Yan wrote:
>> When ata device IDENTIFY failed, the ata device status is
>> ATA_DEV_UNKNOWN. The libata reported like:
>>
>> [113518.620433] ata5.00: qc timeout (cmd 0xec)
>> [113518.653646] ata5.00: failed to IDENTIFY (I/O error, err_mask=0x4)
>>
>> But libsas verifies the device status by ata_dev_disabled(), which
>> skiped ATA_DEV_UNKNOWN. This will make libsas think the ata device
>
> /s/skiped/skipped/
>

OK, thanks.

>> probing succeed the device cannot be actually brought up. And even the
>> new bcast of this device will be considered as flutter and will not
>> probe this device again.
>>
>> Change ata_dev_disabled() to !ata_dev_enabled() so that libsas can
>> deal with this if the ata device probe failed. New bcasts can let us
>> try to probe the device again and bring it up if it is fine to
>> IDENTIFY.
>>
>> Tested-by: Zhou Yupeng <zhouyupeng1@huawei.com>
>> Signed-off-by: Jason Yan <yanaijie@huawei.com>
>
> Reviewed-by: John Garry <john.garry@huawei.com>
>
>> CC: John Garry <john.garry@huawei.com>
>> CC: Johannes Thumshirn <jthumshirn@suse.de>
>> CC: Ewan Milne <emilne@redhat.com>
>> CC: Christoph Hellwig <hch@lst.de>
>> CC: Tomas Henzl <thenzl@redhat.com>
>> CC: Dan Williams <dan.j.williams@intel.com>
>> CC: Hannes Reinecke <hare@suse.com>
>> ---
>>  drivers/scsi/libsas/sas_ata.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/scsi/libsas/sas_ata.c
>> b/drivers/scsi/libsas/sas_ata.c
>> index 64a958a99f6a..4f6cdf53e913 100644
>> --- a/drivers/scsi/libsas/sas_ata.c
>> +++ b/drivers/scsi/libsas/sas_ata.c
>> @@ -654,7 +654,7 @@ void sas_probe_sata(struct asd_sas_port *port)
>>          /* if libata could not bring the link up, don't surface
>>           * the device
>>           */
>> -        if (ata_dev_disabled(sas_to_ata_dev(dev)))
>> +        if (!ata_dev_enabled(sas_to_ata_dev(dev)))
>
> I do wonder if ata_dev_disabled() needs to be updated to cover
> ATA_DEV_UNKNOWN also or even instead of this change?
>

We cannot do this now because this will make the ata eh process wrong.

>>              sas_fail_probe(dev, __func__, -ENODEV);
>>      }
>>
>>
>
>
>
> .
>
diff mbox series

Patch

diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 64a958a99f6a..4f6cdf53e913 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -654,7 +654,7 @@  void sas_probe_sata(struct asd_sas_port *port)
 		/* if libata could not bring the link up, don't surface
 		 * the device
 		 */
-		if (ata_dev_disabled(sas_to_ata_dev(dev)))
+		if (!ata_dev_enabled(sas_to_ata_dev(dev)))
 			sas_fail_probe(dev, __func__, -ENODEV);
 	}