- Added consistency checking for the SRPT command state management
authorbvassche <bvassche@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Mon, 10 Aug 2009 09:57:30 +0000 (09:57 +0000)
committerbvassche <bvassche@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Mon, 10 Aug 2009 09:57:30 +0000 (09:57 +0000)
  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:
  <IRQ>  [<ffffffffa057f578>] ? srpt_handle_new_iu+0x818/0xaf0 [ib_srpt]
  [<ffffffff80243f18>] warn_slowpath_common+0x78/0xd0
  [<ffffffff80243f7f>] warn_slowpath_null+0xf/0x20
  [<ffffffffa057f578>] srpt_handle_new_iu+0x818/0xaf0 [ib_srpt]
  [<ffffffffa057f9ab>] srpt_completion+0x15b/0x230 [ib_srpt]
  [<ffffffffa04351f2>] mlx4_ib_cq_comp+0x12/0x20 [mlx4_ib]
  [<ffffffffa01eb1aa>] mlx4_cq_completion+0x3a/0x80 [mlx4_core]
  [<ffffffffa01ec475>] mlx4_eq_int+0x2a5/0x2e0 [mlx4_core]
  [<ffffffffa01ec59a>] mlx4_msi_x_interrupt+0x6a/0x90 [mlx4_core]
  [<ffffffff8027c0aa>] handle_IRQ_event+0x3a/0xf0
  [<ffffffff8027dee1>] handle_edge_irq+0xc1/0x160
  [<ffffffff8020ec3f>] handle_irq+0x1f/0x30
  [<ffffffff8020e37a>] do_IRQ+0x6a/0xf0
  [<ffffffff8020c7d3>] ret_from_intr+0x0/0xa
  <EOI>  [<ffffffffa0012e52>] ? acpi_idle_enter_simple+0x159/0x187 [processor]
  [<ffffffffa0012e48>] ? acpi_idle_enter_simple+0x14f/0x187 [processor]
  [<ffffffff804323e5>] ? cpuidle_idle_call+0xa5/0x100
  [<ffffffff8020b0a2>] ? cpu_idle+0x62/0xd0
  [<ffffffff804be614>] ? rest_init+0x84/0x90
  [<ffffffff8067ecc5>] ? start_kernel+0x35a/0x415
  [<ffffffff8067e289>] ? x86_64_start_reservations+0x99/0xb9
  [<ffffffff8067e389>] ? x86_64_start_kernel+0xe0/0xf2

git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@1030 d57e44dd-8a1f-0410-8b47-8ef2f437770f

srpt/src/ib_srpt.c

index 93dbaf3..985571c 100644 (file)
@@ -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);