Commit fc3af58d authored by Bart Van Assche's avatar Bart Van Assche Committed by Doug Ledford

IB/srpt: Fix srpt_write_pending()

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: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
Cc: Alex Estrin <alex.estrin@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent aaf45bd8
...@@ -2487,39 +2487,14 @@ static int srpt_write_pending_status(struct se_cmd *se_cmd) ...@@ -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) 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; 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); new_state = srpt_set_cmd_state(ioctx, SRPT_STATE_NEED_DATA);
WARN_ON(new_state == SRPT_STATE_DONE); WARN_ON(new_state == SRPT_STATE_DONE);
return srpt_xfer_data(ch, ioctx);
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;
} }
static u8 tcm_to_srp_tsk_mgmt_status(const int tcm_mgmt_status) static u8 tcm_to_srp_tsk_mgmt_status(const int tcm_mgmt_status)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment