From d68f6300a2e1f22c7c69c1015299f97f225fb5fe Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Sun, 13 Feb 2011 17:02:54 +0000 Subject: [PATCH] Merge of the trunk's r3248: Fix problem with handling internal commands reported by Hiroyuki Sato git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.0.0.x@3249 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_lib.c | 5 +++++ scst/src/scst_priv.h | 2 ++ scst/src/scst_targ.c | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 81099f8b9..2b1ebd86e 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -1979,6 +1979,7 @@ int scst_set_cmd_abnormal_done_state(struct scst_cmd *cmd) case SCST_CMD_STATE_PRE_DEV_DONE: case SCST_CMD_STATE_MODE_SELECT_CHECKS: case SCST_CMD_STATE_PRE_XMIT_RESP: + case SCST_CMD_STATE_FINISHED_INTERNAL: break; default: PRINT_CRIT_ERROR("Wrong cmd state %d (cmd %p, op %x)", @@ -3690,6 +3691,7 @@ static struct scst_cmd *scst_create_prepare_internal_cmd( struct scst_cmd *orig_cmd, int bufsize) { struct scst_cmd *res; + int rc; gfp_t gfp_mask = scst_cmd_atomic(orig_cmd) ? GFP_ATOMIC : GFP_KERNEL; TRACE_ENTRY(); @@ -3716,6 +3718,9 @@ static struct scst_cmd *scst_create_prepare_internal_cmd( if (res->tgt_dev != NULL) __scst_get(); + rc = scst_pre_parse(res); + sBUG_ON(rc != 0); + res->state = SCST_CMD_STATE_PARSE; out: diff --git a/scst/src/scst_priv.h b/scst/src/scst_priv.h index c1b191f9e..e2d7cde0d 100644 --- a/scst/src/scst_priv.h +++ b/scst/src/scst_priv.h @@ -302,6 +302,8 @@ void scst_unblock_deferred(struct scst_tgt_dev *tgt_dev, void scst_on_hq_cmd_response(struct scst_cmd *cmd); void scst_xmit_process_aborted_cmd(struct scst_cmd *cmd); +int scst_pre_parse(struct scst_cmd *cmd); + int scst_cmd_thread(void *arg); void scst_cmd_tasklet(long p); int scst_init_thread(void *arg); diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 782a5d75a..048f98626 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -419,7 +419,7 @@ out: } EXPORT_SYMBOL(scst_cmd_init_done); -static int scst_pre_parse(struct scst_cmd *cmd) +int scst_pre_parse(struct scst_cmd *cmd) { int res; struct scst_device *dev = cmd->dev;