Relax and cleanup HARDWARE ERROR sense usage

HARDWARE ERROR sense is very strong considered be "internal failure", so
might lead to serios initiator side issues up to disconnect from device. In
many cases WRITE or READ ERROR sense can be used instead. All remaining
usages must be logged.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4911 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2013-07-04 02:46:49 +00:00
parent 2755c02421
commit 6e31fd8306
6 changed files with 30 additions and 19 deletions

View File

@@ -3539,9 +3539,11 @@ static void q2t_do_ctio_completion(scsi_qla_host_t *ha, uint32_t handle,
cmd->state = Q2T_STATE_DATA_IN;
if (unlikely(status != CTIO_SUCCESS))
rx_status = SCST_RX_STATUS_ERROR;
else
if (unlikely(status != CTIO_SUCCESS)) {
scst_set_cmd_error(&cmd->scst_cmd,
SCST_LOAD_SENSE(scst_sense_write_error));
rx_status = SCST_RX_STATUS_ERROR_SENSE_SET;
} else
cmd->write_data_transferred = 1;
TRACE_DBG("Data received, context %x, rx_status %d",
@@ -4375,7 +4377,9 @@ out_reject:
NOTIFY_ACK_SRR_FLAGS_REJECT_EXPL_NO_EXPL);
if (cmd->state == Q2T_STATE_NEED_DATA) {
cmd->state = Q2T_STATE_DATA_IN;
scst_rx_data(&cmd->scst_cmd, SCST_RX_STATUS_ERROR,
scst_set_cmd_error(&cmd->scst_cmd,
SCST_LOAD_SENSE(scst_sense_write_error));
scst_rx_data(&cmd->scst_cmd, SCST_RX_STATUS_ERROR_SENSE_SET,
SCST_CONTEXT_THREAD);
} else
q24_send_term_exchange(ha, cmd, &cmd->atio.atio7, 1);
@@ -4464,7 +4468,9 @@ out_reject:
NOTIFY_ACK_SRR_FLAGS_REJECT_EXPL_NO_EXPL);
if (cmd->state == Q2T_STATE_NEED_DATA) {
cmd->state = Q2T_STATE_DATA_IN;
scst_rx_data(&cmd->scst_cmd, SCST_RX_STATUS_ERROR,
scst_set_cmd_error(&cmd->scst_cmd,
SCST_LOAD_SENSE(scst_sense_write_error));
scst_rx_data(&cmd->scst_cmd, SCST_RX_STATUS_ERROR_SENSE_SET,
SCST_CONTEXT_THREAD);
} else
q2x_send_term_exchange(ha, cmd, &cmd->atio.atio2x, 1);

View File

@@ -448,7 +448,7 @@ enum scst_exec_context {
/*
* Fatal error, if returned by xmit_response() the cmd will
* be destroyed, if by any other function, xmit_response()
* will be called with HARDWARE ERROR sense data
* will be called with READ or WRITE FAILED sense data
*/
#define SCST_TGT_RES_FATAL_ERROR -3

View File

@@ -4084,7 +4084,7 @@ static enum compl_status_e fileio_exec_verify(struct vdisk_cmd_params *p)
(long long unsigned int)err,
(long long unsigned int)loff);
scst_set_cmd_error(cmd,
SCST_LOAD_SENSE(scst_sense_hardw_error));
SCST_LOAD_SENSE(scst_sense_read_error));
goto out_set_fs;
}
}
@@ -4093,7 +4093,7 @@ static enum compl_status_e fileio_exec_verify(struct vdisk_cmd_params *p)
if (mem_verify == NULL) {
PRINT_ERROR("Unable to allocate memory %d for verify",
LEN_MEM);
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error));
scst_set_busy(cmd);
goto out_set_fs;
}

View File

@@ -935,14 +935,14 @@ out:
"(target %s, initiator %s, device %s)",
tgt_dev->sess->tgt->tgt_name,
tgt_dev->sess->initiator_name, dev->virt_name);
#if 0 /*
* Looks like it's safer to return SUCCESS and expect operator's
* intervention to be able to save the PR's state next time, than
* to return HARDWARE ERROR and screw up all the interaction with
* the affected initiator.
*/
if (cmd != NULL)
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error));
#if 0 /*
* Looks like it's safer to return SUCCESS and expect operator's
* intervention to be able to save the PR's state next time, than
* to return HARDWARE ERROR and screw up all the interaction with
* the affected initiator.
*/
if (cmd != NULL)
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error));
#endif
}

View File

@@ -1171,7 +1171,10 @@ out_no_space:
goto out;
out_error:
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error));
if (cmd->data_direction & SCST_DATA_WRITE)
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_write_error));
else
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_read_error));
scst_set_cmd_abnormal_done_state(cmd);
res = SCST_CMD_STATE_RES_CONT_SAME;
goto out;
@@ -1400,7 +1403,7 @@ out_error_rc:
PRINT_ERROR("Target driver %s rdy_to_xfer() returned invalid "
"value %d", tgtt->name, rc);
}
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error));
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_write_error));
out_dev_done:
scst_set_cmd_abnormal_done_state(cmd);

View File

@@ -1401,7 +1401,9 @@ static void srpt_abort_cmd(struct srpt_send_ioctx *ioctx,
break;
case SRPT_STATE_NEED_DATA:
/* SCST_DATA_WRITE - RDMA read error or RDMA read timeout. */
scst_rx_data(scmnd, SCST_RX_STATUS_ERROR, context);
scst_set_cmd_error(scmnd,
SCST_LOAD_SENSE(scst_sense_write_error));
scst_rx_data(scmnd, SCST_RX_STATUS_ERROR_SENSE_SET, context);
break;
case SRPT_STATE_CMD_RSP_SENT:
/*