Message ID | 20220929025407.119804-25-michael.christie@oracle.com |
---|---|
State | Superseded |
Headers | show |
Series | Allow scsi_execute users to control retries | expand |
On Wed, 2022-09-28 at 21:53 -0500, Mike Christie wrote: > This has hp_sw have scsi-ml retry scsi_exec_req errors instead of > driving > them itself. > > Signed-off-by: Mike Christie <michael.christie@oracle.com> > --- > drivers/scsi/device_handler/scsi_dh_hp_sw.c | 58 +++++++++++++------ > -- > 1 file changed, 35 insertions(+), 23 deletions(-) > > diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c > b/drivers/scsi/device_handler/scsi_dh_hp_sw.c > index adcbe3b883b7..c186809f2e17 100644 > --- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c > +++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c > @@ -46,9 +46,6 @@ static int tur_done(struct scsi_device *sdev, > struct hp_sw_dh_data *h, > int ret = SCSI_DH_IO; > > switch (sshdr->sense_key) { > - case UNIT_ATTENTION: > - ret = SCSI_DH_IMM_RETRY; > - break; > case NOT_READY: > if (sshdr->asc == 0x04 && sshdr->ascq == 2) { > /* > @@ -85,8 +82,17 @@ static int hp_sw_tur(struct scsi_device *sdev, > struct hp_sw_dh_data *h) > int ret = SCSI_DH_OK, res; > blk_opf_t req_flags = REQ_FAILFAST_DEV | > REQ_FAILFAST_TRANSPORT | > REQ_FAILFAST_DRIVER; > + struct scsi_failure failures[] = { > + { > + .sense = UNIT_ATTENTION, > + .asc = SCMD_FAILURE_ASC_ANY, > + .ascq = SCMD_FAILURE_ASCQ_ANY, > + .allowed = SCMD_FAILURE_NO_LIMIT, > + .result = SAM_STAT_CHECK_CONDITION, > + }, > + {}, > + }; > > -retry: > res = scsi_exec_req(((struct scsi_exec_args) { > .sdev = sdev, > .cmd = cmd, > @@ -94,7 +100,8 @@ static int hp_sw_tur(struct scsi_device *sdev, > struct hp_sw_dh_data *h) > .sshdr = &sshdr, > .timeout = HP_SW_TIMEOUT, > .retries = HP_SW_RETRIES, > - .op_flags = req_flags })); > + .op_flags = req_flags, > + .failures = failures })); > if (res) { > if (scsi_sense_valid(&sshdr)) > ret = tur_done(sdev, h, &sshdr); > @@ -108,8 +115,6 @@ static int hp_sw_tur(struct scsi_device *sdev, > struct hp_sw_dh_data *h) > h->path_state = HP_SW_PATH_ACTIVE; > ret = SCSI_DH_OK; > } > - if (ret == SCSI_DH_IMM_RETRY) > - goto retry; > > return ret; > } > @@ -126,19 +131,33 @@ static int hp_sw_start_stop(struct > hp_sw_dh_data *h) > struct scsi_sense_hdr sshdr; > struct scsi_device *sdev = h->sdev; > int res, rc = SCSI_DH_OK; > - int retry_cnt = HP_SW_RETRIES; > blk_opf_t req_flags = REQ_FAILFAST_DEV | > REQ_FAILFAST_TRANSPORT | > REQ_FAILFAST_DRIVER; > + struct scsi_failure failures[] = { > + { > + /* > + * LUN not ready - manual intervention > required > + * > + * Switch-over in progress, retry. > + */ > + .sense = NOT_READY, > + .asc = 0x04, > + .ascq = 0x03, > + .allowed = HP_SW_RETRIES, > + .result = SAM_STAT_CHECK_CONDITION, > + }, > + {}, > + }; > > -retry: > res = scsi_exec_req(((struct scsi_exec_args) { > - .sdev = sdev, > - .cmd = cmd, > - .data_dir = DMA_NONE, > - .sshdr = &sshdr, > - .timeout = HP_SW_TIMEOUT, > - .retries = HP_SW_RETRIES, > - .op_flags = req_flags })); > + .sdev = sdev, > + .cmd = cmd, > + .data_dir = DMA_NONE, > + .sshdr = &sshdr, > + .timeout = HP_SW_TIMEOUT, > + .retries = HP_SW_RETRIES, > + .op_flags = req_flags, > + .failures = failures })); Nitpick: this looks as if you hadn't got the indentation right in 08/35. Martin
diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c b/drivers/scsi/device_handler/scsi_dh_hp_sw.c index adcbe3b883b7..c186809f2e17 100644 --- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c +++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c @@ -46,9 +46,6 @@ static int tur_done(struct scsi_device *sdev, struct hp_sw_dh_data *h, int ret = SCSI_DH_IO; switch (sshdr->sense_key) { - case UNIT_ATTENTION: - ret = SCSI_DH_IMM_RETRY; - break; case NOT_READY: if (sshdr->asc == 0x04 && sshdr->ascq == 2) { /* @@ -85,8 +82,17 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) int ret = SCSI_DH_OK, res; blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = SCMD_FAILURE_NO_LIMIT, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; -retry: res = scsi_exec_req(((struct scsi_exec_args) { .sdev = sdev, .cmd = cmd, @@ -94,7 +100,8 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) .sshdr = &sshdr, .timeout = HP_SW_TIMEOUT, .retries = HP_SW_RETRIES, - .op_flags = req_flags })); + .op_flags = req_flags, + .failures = failures })); if (res) { if (scsi_sense_valid(&sshdr)) ret = tur_done(sdev, h, &sshdr); @@ -108,8 +115,6 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) h->path_state = HP_SW_PATH_ACTIVE; ret = SCSI_DH_OK; } - if (ret == SCSI_DH_IMM_RETRY) - goto retry; return ret; } @@ -126,19 +131,33 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) struct scsi_sense_hdr sshdr; struct scsi_device *sdev = h->sdev; int res, rc = SCSI_DH_OK; - int retry_cnt = HP_SW_RETRIES; blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + struct scsi_failure failures[] = { + { + /* + * LUN not ready - manual intervention required + * + * Switch-over in progress, retry. + */ + .sense = NOT_READY, + .asc = 0x04, + .ascq = 0x03, + .allowed = HP_SW_RETRIES, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; -retry: res = scsi_exec_req(((struct scsi_exec_args) { - .sdev = sdev, - .cmd = cmd, - .data_dir = DMA_NONE, - .sshdr = &sshdr, - .timeout = HP_SW_TIMEOUT, - .retries = HP_SW_RETRIES, - .op_flags = req_flags })); + .sdev = sdev, + .cmd = cmd, + .data_dir = DMA_NONE, + .sshdr = &sshdr, + .timeout = HP_SW_TIMEOUT, + .retries = HP_SW_RETRIES, + .op_flags = req_flags, + .failures = failures })); if (res) { if (!scsi_sense_valid(&sshdr)) { sdev_printk(KERN_WARNING, sdev, @@ -149,13 +168,6 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) switch (sshdr.sense_key) { case NOT_READY: if (sshdr.asc == 0x04 && sshdr.ascq == 3) { - /* - * LUN not ready - manual intervention required - * - * Switch-over in progress, retry. - */ - if (--retry_cnt) - goto retry; rc = SCSI_DH_RETRY; break; }
This has hp_sw have scsi-ml retry scsi_exec_req errors instead of driving them itself. Signed-off-by: Mike Christie <michael.christie@oracle.com> --- drivers/scsi/device_handler/scsi_dh_hp_sw.c | 58 +++++++++++++-------- 1 file changed, 35 insertions(+), 23 deletions(-)