Commit fabe3ee9 authored by Mike Christie's avatar Mike Christie Committed by Martin K. Petersen

scsi: device_handler: hp_sw: Have midlayer retry scsi_execute_cmd() errors

This has hp_sw have the SCSI midlayer retry scsi_execute_cmd() errors
instead of driving them itself.
Signed-off-by: default avatarMike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20240123002220.129141-7-michael.christie@oracle.comAcked-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent c1acf38c
...@@ -46,9 +46,6 @@ static int tur_done(struct scsi_device *sdev, struct hp_sw_dh_data *h, ...@@ -46,9 +46,6 @@ static int tur_done(struct scsi_device *sdev, struct hp_sw_dh_data *h,
int ret = SCSI_DH_IO; int ret = SCSI_DH_IO;
switch (sshdr->sense_key) { switch (sshdr->sense_key) {
case UNIT_ATTENTION:
ret = SCSI_DH_IMM_RETRY;
break;
case NOT_READY: case NOT_READY:
if (sshdr->asc == 0x04 && sshdr->ascq == 2) { if (sshdr->asc == 0x04 && sshdr->ascq == 2) {
/* /*
...@@ -85,11 +82,24 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) ...@@ -85,11 +82,24 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h)
int ret, res; int ret, res;
blk_opf_t opf = REQ_OP_DRV_IN | REQ_FAILFAST_DEV | blk_opf_t opf = REQ_OP_DRV_IN | REQ_FAILFAST_DEV |
REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER;
struct scsi_failure failure_defs[] = {
{
.sense = UNIT_ATTENTION,
.asc = SCMD_FAILURE_ASC_ANY,
.ascq = SCMD_FAILURE_ASCQ_ANY,
.allowed = SCMD_FAILURE_NO_LIMIT,
.result = SAM_STAT_CHECK_CONDITION,
},
{}
};
struct scsi_failures failures = {
.failure_definitions = failure_defs,
};
const struct scsi_exec_args exec_args = { const struct scsi_exec_args exec_args = {
.sshdr = &sshdr, .sshdr = &sshdr,
.failures = &failures,
}; };
retry:
res = scsi_execute_cmd(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT, res = scsi_execute_cmd(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT,
HP_SW_RETRIES, &exec_args); HP_SW_RETRIES, &exec_args);
if (res > 0 && scsi_sense_valid(&sshdr)) { if (res > 0 && scsi_sense_valid(&sshdr)) {
...@@ -104,9 +114,6 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) ...@@ -104,9 +114,6 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h)
ret = SCSI_DH_IO; ret = SCSI_DH_IO;
} }
if (ret == SCSI_DH_IMM_RETRY)
goto retry;
return ret; return ret;
} }
...@@ -122,14 +129,31 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) ...@@ -122,14 +129,31 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h)
struct scsi_sense_hdr sshdr; struct scsi_sense_hdr sshdr;
struct scsi_device *sdev = h->sdev; struct scsi_device *sdev = h->sdev;
int res, rc; int res, rc;
int retry_cnt = HP_SW_RETRIES;
blk_opf_t opf = REQ_OP_DRV_IN | REQ_FAILFAST_DEV | blk_opf_t opf = REQ_OP_DRV_IN | REQ_FAILFAST_DEV |
REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER;
struct scsi_failure failure_defs[] = {
{
/*
* 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,
},
{}
};
struct scsi_failures failures = {
.failure_definitions = failure_defs,
};
const struct scsi_exec_args exec_args = { const struct scsi_exec_args exec_args = {
.sshdr = &sshdr, .sshdr = &sshdr,
.failures = &failures,
}; };
retry:
res = scsi_execute_cmd(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT, res = scsi_execute_cmd(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT,
HP_SW_RETRIES, &exec_args); HP_SW_RETRIES, &exec_args);
if (!res) { if (!res) {
...@@ -144,13 +168,6 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) ...@@ -144,13 +168,6 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h)
switch (sshdr.sense_key) { switch (sshdr.sense_key) {
case NOT_READY: case NOT_READY:
if (sshdr.asc == 0x04 && sshdr.ascq == 3) { 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; rc = SCSI_DH_RETRY;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment