From 7c25f55ad98d039354a7babc9db885b53e781bda Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 1 Aug 2009 06:03:55 +0000 Subject: [PATCH] Only call scst_tgt_cmd_done() if scst_rx_data() has not been called. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@999 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index e5305a42b..3db483574 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -817,17 +817,20 @@ static void srpt_abort_scst_cmd(struct srpt_device *sdev, scst_cmd_get_sg_cnt(scmnd), scst_to_tgt_dma_dir(dir)); - if (scmnd->state == SCST_CMD_STATE_DATA_WAIT) + if (scmnd->state == SCST_CMD_STATE_DATA_WAIT) { scst_rx_data(scmnd, tell_initiator ? SCST_RX_STATUS_ERROR : SCST_RX_STATUS_ERROR_FATAL, SCST_CONTEXT_THREAD); - else if (scmnd->state == SCST_CMD_STATE_XMIT_WAIT) + goto out; + } else if (scmnd->state == SCST_CMD_STATE_XMIT_WAIT) ; } scst_set_delivery_status(scmnd, SCST_CMD_DELIVERY_FAILED); scst_tgt_cmd_done(scmnd, scst_estimate_context()); +out: + return; } static void srpt_handle_err_comp(struct srpt_rdma_ch *ch, struct ib_wc *wc) @@ -1390,6 +1393,7 @@ static int srpt_release_channel(struct srpt_rdma_ch *ch, int destroy_cmid) spin_lock_irq(&ch->spinlock); } + WARN_ON(! list_empty(&ch->active_scmnd_list)); WARN_ON(ch->active_scmnd_cnt != 0); spin_unlock_irq(&ch->spinlock);