Re: [PATCH v12 04/20] scsi: sd: Have scsi-ml retry read_capacity_16 errors

John Garry
2023-11-16T11:39:41Z

On 14/11/2023 01:37, Mike Christie wrote:

Feel free to pick up:
Reviewed-by: John Garry <john.g.garry@oracle.com>

> + the_result = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, buffer,
> + RC16_LEN, SD_TIMEOUT, sdkp->max_retries,

BTW, some might find it a little confusing that we have
scsi_execute_cmd() retries arg as well as being able to pass
exec_args.failure, and exec_args.failure may allow us to retry. Could
this be improved, even in terms of arg or struct member naming/comments?

Thanks,
John

> + &exec_args);
>
> - } while (the_result && retries);
> + if (the_result > 0) {
> + if (media_not_present(sdkp, &sshdr))
> + return -ENODEV;
> +
> + sense_valid = scsi_sense_valid(&sshdr);
> + if (sense_valid && sshdr.sense_key == ILLEGAL_REQUEST &&
> + (sshdr.asc == 0x20 || sshdr.asc == 0x24) &&
> + sshdr.ascq == 0x00) {
> + /*
> + * Invalid Command Operation Code or Invalid Field in
> + * CDB, just retry silently with RC10
> + */
> + return -EINVAL;
> + }
> + }