On Wed, 2022-09-28 at 21:53 -0500, Mike Christie wrote: > This has read_capacity_16 have scsi-ml retry errors instead of > driving > them itself. > > Signed-off-by: Mike Christie <michael.christie@xxxxxxxxxx> > --- > drivers/scsi/sd.c | 82 +++++++++++++++++++++++++-------------------- > -- > 1 file changed, 43 insertions(+), 39 deletions(-) > > diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c > index 37eafa968116..a35c089c3097 100644 > --- a/drivers/scsi/sd.c > +++ b/drivers/scsi/sd.c > @@ -2283,55 +2283,59 @@ static int read_capacity_16(struct scsi_disk > *sdkp, struct scsi_device *sdp, > struct scsi_sense_hdr sshdr; > int sense_valid = 0; > int the_result; > - int retries = 3, reset_retries = > READ_CAPACITY_RETRIES_ON_RESET; > unsigned int alignment; > unsigned long long lba; > unsigned sector_size; > + struct scsi_failure failures[] = { > + { > + .sense = UNIT_ATTENTION, > + .asc = 0x29, > + .ascq = 0, > + /* Device reset might occur several times */ > + .allowed = READ_CAPACITY_RETRIES_ON_RESET, > + .result = SAM_STAT_CHECK_CONDITION, > + }, > + { > + .result = SCMD_FAILURE_ANY, > + .allowed = 3, > + }, > + {}, > + }; I first wondered whether this was correct, until I realized that the logic in patch 02/35 actually treats the counts for different failures independently, so that the maximum overall retry count is the sum of the individual retry counts. I wonder if we should give callers the chance to set a limit for the overall retry count in addition to the retry counts for individual failures. Martin