IB/srpt: Fix srpt_write_pending()
authorBart Van Assche <bart.vanassche@sandisk.com>
Thu, 11 Feb 2016 19:09:10 +0000 (11:09 -0800)
committerDoug Ledford <dledford@redhat.com>
Mon, 29 Feb 2016 22:12:36 +0000 (17:12 -0500)
The only allowed return values for the write_pending() callback
function are 0, -EAGAIN and -ENOMEM. Since attempting to perform
RDMA over a disconnecting channel will result in an IB error
completion anyway, remove the code that checks the channel state
from srpt_write_pending().

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Cc: Alex Estrin <alex.estrin@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/ulp/srpt/ib_srpt.c

index 0881ae902ba032c545da42b3381a2b63e1a580cf..12cc695c445599d4813de968d4f46985054b1edf 100644 (file)
@@ -2487,39 +2487,14 @@ static int srpt_write_pending_status(struct se_cmd *se_cmd)
  */
 static int srpt_write_pending(struct se_cmd *se_cmd)
 {
-       struct srpt_rdma_ch *ch;
-       struct srpt_send_ioctx *ioctx;
+       struct srpt_send_ioctx *ioctx =
+               container_of(se_cmd, struct srpt_send_ioctx, cmd);
+       struct srpt_rdma_ch *ch = ioctx->ch;
        enum srpt_command_state new_state;
-       int ret;
-
-       ioctx = container_of(se_cmd, struct srpt_send_ioctx, cmd);
 
        new_state = srpt_set_cmd_state(ioctx, SRPT_STATE_NEED_DATA);
        WARN_ON(new_state == SRPT_STATE_DONE);
-
-       ch = ioctx->ch;
-       BUG_ON(!ch);
-
-       switch (ch->state) {
-       case CH_CONNECTING:
-               WARN(true, "unexpected channel state %d\n", ch->state);
-               ret = -EINVAL;
-               goto out;
-       case CH_LIVE:
-               break;
-       case CH_DISCONNECTING:
-       case CH_DRAINING:
-       case CH_DISCONNECTED:
-               pr_debug("cmd with tag %lld: channel disconnecting\n",
-                        ioctx->cmd.tag);
-               srpt_set_cmd_state(ioctx, SRPT_STATE_DATA_IN);
-               ret = -EINVAL;
-               goto out;
-       }
-       ret = srpt_xfer_data(ch, ioctx);
-
-out:
-       return ret;
+       return srpt_xfer_data(ch, ioctx);
 }
 
 static u8 tcm_to_srp_tsk_mgmt_status(const int tcm_mgmt_status)