Skip to content

Commit 2274bd5

Browse files
mikechristiemartinkpetersen
authored andcommitted
scsi: rdac: Fix send_mode_select retry handling
If send_mode_select retries scsi_execute_cmd it will leave err set to SCSI_DH_RETRY/SCSI_DH_IMM_RETRY. If on the retry, the command is successful, then SCSI_DH_RETRY/SCSI_DH_IMM_RETRY will be returned to the scsi_dh activation caller. On the retry, we will then detect the previous MODE SELECT had worked, and so we will return success. This patch has us return the correct return value, so we can avoid the extra scsi_dh activation call and to avoid failures if the caller had hit its activation retry limit and does not end up retrying. Signed-off-by: Mike Christie <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Martin Wilck <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 5759a56 commit 2274bd5

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

drivers/scsi/device_handler/scsi_dh_rdac.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ static void send_mode_select(struct work_struct *work)
530530
container_of(work, struct rdac_controller, ms_work);
531531
struct scsi_device *sdev = ctlr->ms_sdev;
532532
struct rdac_dh_data *h = sdev->handler_data;
533-
int err = SCSI_DH_OK, retry_cnt = RDAC_RETRY_COUNT;
533+
int err, retry_cnt = RDAC_RETRY_COUNT;
534534
struct rdac_queue_data *tmp, *qdata;
535535
LIST_HEAD(list);
536536
unsigned char cdb[MAX_COMMAND_SIZE];
@@ -558,20 +558,20 @@ static void send_mode_select(struct work_struct *work)
558558
(char *) h->ctlr->array_name, h->ctlr->index,
559559
(retry_cnt == RDAC_RETRY_COUNT) ? "queueing" : "retrying");
560560

561-
if (scsi_execute_cmd(sdev, cdb, opf, &h->ctlr->mode_select, data_size,
562-
RDAC_TIMEOUT * HZ, RDAC_RETRIES, &exec_args)) {
561+
if (!scsi_execute_cmd(sdev, cdb, opf, &h->ctlr->mode_select, data_size,
562+
RDAC_TIMEOUT * HZ, RDAC_RETRIES, &exec_args)) {
563+
h->state = RDAC_STATE_ACTIVE;
564+
RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, "
565+
"MODE_SELECT completed",
566+
(char *) h->ctlr->array_name, h->ctlr->index);
567+
err = SCSI_DH_OK;
568+
} else {
563569
err = mode_select_handle_sense(sdev, &sshdr);
564570
if (err == SCSI_DH_RETRY && retry_cnt--)
565571
goto retry;
566572
if (err == SCSI_DH_IMM_RETRY)
567573
goto retry;
568574
}
569-
if (err == SCSI_DH_OK) {
570-
h->state = RDAC_STATE_ACTIVE;
571-
RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, "
572-
"MODE_SELECT completed",
573-
(char *) h->ctlr->array_name, h->ctlr->index);
574-
}
575575

576576
list_for_each_entry_safe(qdata, tmp, &list, entry) {
577577
list_del(&qdata->entry);

0 commit comments

Comments
 (0)