From 2cd7071377b4a26e51880f12e2d2ed9f74f6ac2e Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Thu, 12 Jun 2008 18:37:31 +0000 Subject: [PATCH] Fixes broken REQUEST SENSE git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@410 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_lib.c | 2 +- scst/src/scst_targ.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 517ee5126..da8308b24 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -906,7 +906,7 @@ struct scst_cmd *scst_create_prepare_internal_cmd( res->cmd_lists = orig_cmd->cmd_lists; res->sess = orig_cmd->sess; - res->state = SCST_CMD_STATE_DEV_PARSE; + res->state = SCST_CMD_STATE_PRE_PARSE; res->atomic = scst_cmd_atomic(orig_cmd); res->internal = 1; res->tgtt = orig_cmd->tgtt; diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 252adf76a..78307da7f 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -2177,15 +2177,18 @@ static int scst_check_auto_sense(struct scst_cmd *cmd) return res; } -static int scst_done_cmd_check(struct scst_cmd *cmd, int *pres) +static int scst_done_cmd_check(struct scst_cmd **pcmd, int *pres) { int res = 0, rc; + struct scst_cmd *cmd = *pcmd; TRACE_ENTRY(); if (unlikely(cmd->cdb[0] == REQUEST_SENSE)) { - if (cmd->internal) + if (cmd->internal) { cmd = scst_complete_request_sense(cmd); + *pcmd = cmd; + } } else if (unlikely(scst_check_auto_sense(cmd))) { PRINT_INFO("Command finished with CHECK CONDITION, but " "without sense data (opcode 0x%x), issuing " @@ -2323,7 +2326,7 @@ static int scst_pre_dev_done(struct scst_cmd *cmd) TRACE_ENTRY(); - rc = scst_done_cmd_check(cmd, &res); + rc = scst_done_cmd_check(&cmd, &res); if (rc) goto out;