Re: [PATCH 13/24] scsi: Kill DRIVER_SENSE

2019-10-21 Thread Hannes Reinecke
On 10/22/19 1:44 AM, Finn Thain wrote:
> 
>> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
>> b/drivers/scsi/megaraid/megaraid_sas_base.c
>> index c40fbea06cc5..649f9610ca72 100644
>> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
>> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>> @@ -1,3 +1,4 @@
>> +
>>  // SPDX-License-Identifier: GPL-2.0-or-later
>>  /*
>>   *  Linux MegaRAID driver for SAS based RAID controllers
> 
> Typo?
> 
Indeed. Will fix it up.

>> index 59443e0184fd..d6ecb773c512 100644
>> --- a/drivers/scsi/scsi.c
>> +++ b/drivers/scsi/scsi.c
>> @@ -203,8 +203,8 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
>>   * If we have valid sense information, then some kind of recovery
>>   * must have taken place.  Make a note of this.
>>   */
>> -if (SCSI_SENSE_VALID(cmd))
>> -cmd->result |= (DRIVER_SENSE << 24);
>> +if (SCSI_SENSE_VALID(cmd) && status_byte(cmd->result) == SAM_STAT_GOOD)
>> +set_status_byte(cmd, SAM_STAT_CHECK_CONDITION);
> 
> This means that a REQUEST SENSE command can never result in SAM_STAT_GOOD, 
> right? Are there implications for higher layers?
> 
Hmm. Blasted REQUEST SENSE.
Indeed a REQUEST SENSE command should never return with CHECK_CONDITION.
But then a REQUEST SENSE command returns with the sense code in the
payload, which equally is not something which is expected.

I'll be having a look here.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke   Teamlead Storage & Networking
h...@suse.de  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 247165 (AG München), GF: Felix Imendörffer


Re: [PATCH 13/24] scsi: Kill DRIVER_SENSE

2019-10-21 Thread Finn Thain


> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index c40fbea06cc5..649f9610ca72 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -1,3 +1,4 @@
> +
>  // SPDX-License-Identifier: GPL-2.0-or-later
>  /*
>   *  Linux MegaRAID driver for SAS based RAID controllers

Typo?

> index 59443e0184fd..d6ecb773c512 100644
> --- a/drivers/scsi/scsi.c
> +++ b/drivers/scsi/scsi.c
> @@ -203,8 +203,8 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
>* If we have valid sense information, then some kind of recovery
>* must have taken place.  Make a note of this.
>*/
> - if (SCSI_SENSE_VALID(cmd))
> - cmd->result |= (DRIVER_SENSE << 24);
> + if (SCSI_SENSE_VALID(cmd) && status_byte(cmd->result) == SAM_STAT_GOOD)
> + set_status_byte(cmd, SAM_STAT_CHECK_CONDITION);

This means that a REQUEST SENSE command can never result in SAM_STAT_GOOD, 
right? Are there implications for higher layers?

--