mbox series

[0/3] Improve error handling

Message ID 20200910073952.212130-1-damien.lemoal@wdc.com
Headers show
Series Improve error handling | expand

Message

Damien Le Moal Sept. 10, 2020, 7:39 a.m. UTC
A small series to improve command error hadling.

The first patch is a simple code cleanup. The second patch updates
asc/ascq sense codes list. Finally, the third patch adds zone resource
errors handling for zoned block deives to return BLK_STS_DEV_RESOURCE,
similarly to what the NVMe driver does for ZNS devices.

Damien Le Moal (3):
  scsi: Cleanup scsi_noretry_cmd()
  scsi: update additional sense codes list
  scsi: handle zone resources errors

 drivers/scsi/scsi_error.c  |  4 +--
 drivers/scsi/scsi_lib.c    | 12 +++++++++
 drivers/scsi/sense_codes.h | 54 +++++++++++++++++++++++++++++++++++++-
 3 files changed, 67 insertions(+), 3 deletions(-)

Comments

Damien Le Moal Sept. 10, 2020, 10:07 p.m. UTC | #1
On 2020/09/11 2:48, Bart Van Assche wrote:
> On 2020-09-10 00:39, Damien Le Moal wrote:
>> No need for else after return.
>>
>> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
>> ---
>>  drivers/scsi/scsi_error.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
>> index 927b1e641842..5f3726abed78 100644
>> --- a/drivers/scsi/scsi_error.c
>> +++ b/drivers/scsi/scsi_error.c
>> @@ -1755,8 +1755,8 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd)
>>  	if (scmd->request->cmd_flags & REQ_FAILFAST_DEV ||
>>  	    blk_rq_is_passthrough(scmd->request))
>>  		return 1;
>> -	else
>> -		return 0;
>> +
>> +	return 0;
>>  }
> 
> Is this patch useful? Is it necessary? Or is it just code churn?

Sure, you may consider it code churn, but I prefer the more positive view that
it improves code style. And looking at it again, I think the proper change
should actually be:

	return scmd->request->cmd_flags & REQ_FAILFAST_DEV ||
		blk_rq_is_passthrough(scmd->request);

A lot cleaner.

But no strong feelings. If you really do not like the change, I will drop it.

Best regards.