Merge of r500:

Fixes possible oops in double reset UAs handling



git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/1.0.0.x@502 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2008-09-26 16:25:05 +00:00
parent a25b4db71d
commit e349f1cd5d
3 changed files with 12 additions and 2 deletions

View File

@@ -1199,6 +1199,10 @@ struct scst_cmd {
*/
int resp_data_len;
/*
* The status fields in case of errors must be set using
* scst_set_cmd_error_status()!
*/
uint8_t status; /* status byte from target device */
uint8_t msg_status; /* return status from host adapter itself */
uint8_t host_status; /* set by low-level driver to indicate status */

View File

@@ -1383,8 +1383,9 @@ struct scst_cmd *scst_alloc_cmd(int gfp_mask)
cmd->data_len = -1;
cmd->is_send_status = 1;
cmd->resp_data_len = -1;
cmd->dbl_ua_orig_resp_data_len = -1;
cmd->dbl_ua_orig_data_direction = SCST_DATA_UNKNOWN;
cmd->dbl_ua_orig_resp_data_len = -1;
out:
TRACE_EXIT();

View File

@@ -1104,9 +1104,14 @@ static void scst_do_cmd_done(struct scst_cmd *cmd, int result,
scst_set_resp_data_len(cmd, cmd->resp_data_len - resid);
}
if (cmd->status == SAM_STAT_CHECK_CONDITION)
if (unlikely(cmd->status == SAM_STAT_CHECK_CONDITION)) {
/* We might have double reset UA here */
cmd->dbl_ua_orig_resp_data_len = cmd->resp_data_len;
cmd->dbl_ua_orig_data_direction = cmd->data_direction;
scst_alloc_set_sense(cmd, scst_is_context_gfp_atomic(),
rq_sense, rq_sense_len);
}
TRACE(TRACE_SCSI, "result=%x, cmd->status=%x, resid=%d, "
"cmd->msg_status=%x, cmd->host_status=%x, "