From ef509acbd82a19e3f8b7bf0934a3e3381b6483f2 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 24 Jul 2010 11:46:29 +0000 Subject: [PATCH] Refined the timeout error message. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1872 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index c2b8f2e45..d24bf0a89 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -3021,13 +3021,32 @@ out_unmap: static void srpt_pending_cmd_timeout(struct scst_cmd *scmnd) { struct srpt_ioctx *ioctx; + enum srpt_command_state state; ioctx = scst_cmd_get_tgt_priv(scmnd); BUG_ON(!ioctx); - PRINT_ERROR("IB completion for wr_id %u has not been received in time" - " (SRPT command state %d)", - ioctx->index, srpt_get_cmd_state(ioctx)); + state = srpt_get_cmd_state(ioctx); + switch (state) { + case SRPT_STATE_NEW: + case SRPT_STATE_DATA_IN: + case SRPT_STATE_DONE: + /* + * srpt_pending_cmd_timeout() should never be invoked for + * commands in this state. + */ + PRINT_ERROR("Processing SCST command %p (SRPT state %d) took" + " too long -- aborting", scmnd, state); + break; + case SRPT_STATE_NEED_DATA: + case SRPT_STATE_CMD_RSP_SENT: + case SRPT_STATE_MGMT_RSP_SENT: + default: + PRINT_ERROR("Command %p: IB completion for wr_id %u has not" + " been received in time (SRPT command state %d)", + scmnd, ioctx->index, state); + break; + } srpt_abort_scst_cmd(ioctx, SCST_CONTEXT_SAME); }