From f36e96833d732137b2e84be376f6da7cc7ab5b8a Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Thu, 30 Jun 2011 01:01:17 +0000 Subject: [PATCH] - scst_check_local_events() should be called in scst_real_exec() and scst_local_exec(), because if a command passed in those procedures, it for sure was delayed in some list, so recheck if it was aborted is necessary. - Cleanup git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3645 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_targ.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index d787fc73e..14d00009d 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -2587,13 +2587,17 @@ out_done: static inline int scst_real_exec(struct scst_cmd *cmd) { - int res; + int res, rc; TRACE_ENTRY(); BUILD_BUG_ON(SCST_CMD_STATE_RES_CONT_SAME != SCST_EXEC_NOT_COMPLETED); BUILD_BUG_ON(SCST_CMD_STATE_RES_CONT_NEXT != SCST_EXEC_COMPLETED); + rc = scst_check_local_events(cmd); + if (unlikely(rc != 0)) + goto out_done; + __scst_cmd_get(cmd); res = scst_do_real_exec(cmd); @@ -2611,8 +2615,14 @@ static inline int scst_real_exec(struct scst_cmd *cmd) /* SCST_EXEC_* match SCST_CMD_STATE_RES_* */ +out: TRACE_EXIT_RES(res); return res; + +out_done: + cmd->scst_cmd_done(cmd, SCST_CMD_STATE_DEFAULT, SCST_CONTEXT_SAME); + res = SCST_CMD_STATE_RES_CONT_NEXT; + goto out; } static int scst_do_local_exec(struct scst_cmd *cmd) @@ -2678,13 +2688,17 @@ out_done: static int scst_local_exec(struct scst_cmd *cmd) { - int res; + int res, rc; TRACE_ENTRY(); BUILD_BUG_ON(SCST_CMD_STATE_RES_CONT_SAME != SCST_EXEC_NOT_COMPLETED); BUILD_BUG_ON(SCST_CMD_STATE_RES_CONT_NEXT != SCST_EXEC_COMPLETED); + rc = scst_check_local_events(cmd); + if (unlikely(rc != 0)) + goto out_done; + __scst_cmd_get(cmd); res = scst_do_local_exec(cmd); @@ -2698,8 +2712,15 @@ static int scst_local_exec(struct scst_cmd *cmd) __scst_cmd_put(cmd); /* SCST_EXEC_* match SCST_CMD_STATE_RES_* */ + +out: TRACE_EXIT_RES(res); return res; + +out_done: + cmd->scst_cmd_done(cmd, SCST_CMD_STATE_DEFAULT, SCST_CONTEXT_SAME); + res = SCST_CMD_STATE_RES_CONT_NEXT; + goto out; } static int scst_pre_exec_checks(struct scst_cmd *cmd) @@ -2728,7 +2749,7 @@ static int scst_exec_check_blocking(struct scst_cmd **active_cmd) { struct scst_cmd *cmd = *active_cmd; struct scst_cmd *ref_cmd; - int count = 0, rc; + int count = 0; TRACE_ENTRY();