mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-17 10:41:26 +00:00
Improve handling of aborted internal commands
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5533 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -4926,15 +4926,22 @@ static void scst_complete_request_sense(struct scst_cmd *req_cmd)
|
||||
|
||||
if (scsi_status_is_good(req_cmd->status) && (len > 0) &&
|
||||
scst_sense_valid(buf) && !scst_no_sense(buf)) {
|
||||
TRACE(TRACE_SCSI, "REQUEST SENSE %p returned valid sense",
|
||||
req_cmd);
|
||||
TRACE(TRACE_SCSI|TRACE_MGMT_DEBUG, "REQUEST SENSE %p returned "
|
||||
"valid sense", req_cmd);
|
||||
PRINT_BUFF_FLAG(TRACE_SCSI|TRACE_MGMT_DEBUG, "Sense", buf, len);
|
||||
scst_alloc_set_sense(orig_cmd, scst_cmd_atomic(req_cmd),
|
||||
buf, len);
|
||||
} else {
|
||||
PRINT_ERROR("%s", "Unable to get the sense via "
|
||||
"REQUEST SENSE, returning HARDWARE ERROR");
|
||||
scst_set_cmd_error(orig_cmd,
|
||||
SCST_LOAD_SENSE(scst_sense_hardw_error));
|
||||
if (test_bit(SCST_CMD_ABORTED, &req_cmd->cmd_flags) &&
|
||||
!test_bit(SCST_CMD_ABORTED, &orig_cmd->cmd_flags)) {
|
||||
TRACE_MGMT_DBG("REQUEST SENSE %p was aborted, but "
|
||||
"orig_cmd %p - not, retry", req_cmd, orig_cmd);
|
||||
} else {
|
||||
PRINT_ERROR("%s", "Unable to get the sense via "
|
||||
"REQUEST SENSE, returning HARDWARE ERROR");
|
||||
scst_set_cmd_error(orig_cmd,
|
||||
SCST_LOAD_SENSE(scst_sense_hardw_error));
|
||||
}
|
||||
}
|
||||
|
||||
if (len > 0)
|
||||
|
||||
@@ -2745,6 +2745,11 @@ int __scst_check_local_events(struct scst_cmd *cmd, bool preempt_tests_only)
|
||||
TRACE_ENTRY();
|
||||
|
||||
if (unlikely(cmd->internal)) {
|
||||
if (unlikely(test_bit(SCST_CMD_ABORTED, &cmd->cmd_flags))) {
|
||||
TRACE_MGMT_DBG("ABORTED set, aborting internal "
|
||||
"cmd %p", cmd);
|
||||
goto out_uncomplete;
|
||||
}
|
||||
/*
|
||||
* The original command passed all checks and not finished yet
|
||||
*/
|
||||
@@ -3464,11 +3469,14 @@ static bool scst_check_auto_sense(struct scst_cmd *cmd)
|
||||
|
||||
if (unlikely(cmd->status == SAM_STAT_CHECK_CONDITION) &&
|
||||
(!scst_sense_valid(cmd->sense) || scst_no_sense(cmd->sense))) {
|
||||
TRACE(TRACE_SCSI|TRACE_MINOR_AND_MGMT_DBG, "CHECK_CONDITION, "
|
||||
"but no sense: cmd->status=%x, cmd->msg_status=%x, "
|
||||
"cmd->host_status=%x, cmd->driver_status=%x (cmd %p)",
|
||||
cmd->status, cmd->msg_status, cmd->host_status,
|
||||
cmd->driver_status, cmd);
|
||||
if (!test_bit(SCST_CMD_ABORTED, &cmd->cmd_flags)) {
|
||||
TRACE(TRACE_SCSI|TRACE_MINOR_AND_MGMT_DBG,
|
||||
"CHECK_CONDITION, but no sense: cmd->status=%x, "
|
||||
"cmd->msg_status=%x, cmd->host_status=%x, "
|
||||
"cmd->driver_status=%x (cmd %p)",
|
||||
cmd->status, cmd->msg_status, cmd->host_status,
|
||||
cmd->driver_status, cmd);
|
||||
}
|
||||
res = true;
|
||||
} else if (unlikely(cmd->host_status)) {
|
||||
if ((cmd->host_status == DID_REQUEUE) ||
|
||||
@@ -3499,9 +3507,11 @@ static int scst_pre_dev_done(struct scst_cmd *cmd)
|
||||
|
||||
rc = scst_check_auto_sense(cmd);
|
||||
if (unlikely(rc)) {
|
||||
if (test_bit(SCST_CMD_ABORTED, &cmd->cmd_flags))
|
||||
goto next;
|
||||
PRINT_INFO("Command finished with CHECK CONDITION, but "
|
||||
"without sense data (opcode %s), issuing "
|
||||
"REQUEST SENSE", scst_get_opcode_name(cmd));
|
||||
"without sense data (opcode %s), issuing "
|
||||
"REQUEST SENSE", scst_get_opcode_name(cmd));
|
||||
rc = scst_prepare_request_sense(cmd);
|
||||
if (rc == 0)
|
||||
res = SCST_CMD_STATE_RES_CONT_NEXT;
|
||||
@@ -3514,6 +3524,7 @@ static int scst_pre_dev_done(struct scst_cmd *cmd)
|
||||
goto out;
|
||||
}
|
||||
|
||||
next:
|
||||
rc = scst_check_sense(cmd);
|
||||
if (unlikely(rc)) {
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user