From 3d227b8f7335bde39a0ee6460dd7a97cfea4c4d6 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 10 Aug 2009 09:57:30 +0000 Subject: [PATCH] - Added consistency checking for the SRPT command state management introduced in r1026. - Removed WARN_ON() statements that could trigger a warning when nothing was wrong because these were reading uninitialized memory. These statements were introduced in r1026. The call stack of the warning logged in the kernel log is as follows: [] ? srpt_handle_new_iu+0x818/0xaf0 [ib_srpt] [] warn_slowpath_common+0x78/0xd0 [] warn_slowpath_null+0xf/0x20 [] srpt_handle_new_iu+0x818/0xaf0 [ib_srpt] [] srpt_completion+0x15b/0x230 [ib_srpt] [] mlx4_ib_cq_comp+0x12/0x20 [mlx4_ib] [] mlx4_cq_completion+0x3a/0x80 [mlx4_core] [] mlx4_eq_int+0x2a5/0x2e0 [mlx4_core] [] mlx4_msi_x_interrupt+0x6a/0x90 [mlx4_core] [] handle_IRQ_event+0x3a/0xf0 [] handle_edge_irq+0xc1/0x160 [] handle_irq+0x1f/0x30 [] do_IRQ+0x6a/0xf0 [] ret_from_intr+0x0/0xa [] ? acpi_idle_enter_simple+0x159/0x187 [processor] [] ? acpi_idle_enter_simple+0x14f/0x187 [processor] [] ? cpuidle_idle_call+0xa5/0x100 [] ? cpu_idle+0x62/0xd0 [] ? rest_init+0x84/0x90 [] ? start_kernel+0x35a/0x415 [] ? x86_64_start_reservations+0x99/0xb9 [] ? x86_64_start_kernel+0xe0/0xf2 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1030 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 93dbaf3d9..985571c15 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -873,6 +873,20 @@ static void srpt_abort_scst_cmd(struct srpt_device *sdev, scst_cmd_get_sg_cnt(scmnd), scst_to_tgt_dma_dir(dir)); +#if 1 + switch (scmnd->state) { + case SCST_CMD_STATE_DATA_WAIT: + WARN_ON(ioctx->state != SRPT_STATE_NEED_DATA); + break; + case SCST_CMD_STATE_XMIT_WAIT: + WARN_ON(ioctx->state != SRPT_STATE_PROCESSED); + break; + default: + WARN_ON(ioctx->state == SRPT_STATE_NEED_DATA || + ioctx->state == SRPT_STATE_PROCESSED); + } +#endif + if (ioctx->state == SRPT_STATE_NEED_DATA) { scst_rx_data(scmnd, tell_initiator ? SCST_RX_STATUS_ERROR @@ -1118,8 +1132,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch, struct srpt_ioctx *ioctx) scst_cmd_init_done(scmnd, scst_estimate_context()); - WARN_ON(srp_rsp->opcode == SRP_RSP); - return 0; err: @@ -1308,8 +1320,6 @@ static void srpt_handle_new_iu(struct srpt_rdma_ch *ch, goto err; } - WARN_ON(srp_rsp->opcode == SRP_RSP); - dma_sync_single_for_device(ch->sport->sdev->device->dma_device, ioctx->dma, MAX_MESSAGE_SIZE, DMA_FROM_DEVICE);