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

IB/srpt: Fix srpt_handle_cmd() error paths

The target core function that should be called if target_submit_cmd()
fails is target_put_sess_cmd(). Additionally, change the return type
of srpt_handle_cmd() from int into void.
Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarAlex Estrin <alex.estrin@intel.com>
Cc: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent f108f0f6
...@@ -91,6 +91,7 @@ MODULE_PARM_DESC(srpt_service_guid, ...@@ -91,6 +91,7 @@ MODULE_PARM_DESC(srpt_service_guid,
" instead of using the node_guid of the first HCA."); " instead of using the node_guid of the first HCA.");
static struct ib_client srpt_client; static struct ib_client srpt_client;
static void srpt_release_cmd(struct se_cmd *se_cmd);
static void srpt_release_channel(struct srpt_rdma_ch *ch); static void srpt_release_channel(struct srpt_rdma_ch *ch);
static int srpt_queue_status(struct se_cmd *cmd); static int srpt_queue_status(struct se_cmd *cmd);
static void srpt_recv_done(struct ib_cq *cq, struct ib_wc *wc); static void srpt_recv_done(struct ib_cq *cq, struct ib_wc *wc);
...@@ -1492,15 +1493,14 @@ static int srpt_check_stop_free(struct se_cmd *cmd) ...@@ -1492,15 +1493,14 @@ static int srpt_check_stop_free(struct se_cmd *cmd)
/** /**
* srpt_handle_cmd() - Process SRP_CMD. * srpt_handle_cmd() - Process SRP_CMD.
*/ */
static int srpt_handle_cmd(struct srpt_rdma_ch *ch, static void srpt_handle_cmd(struct srpt_rdma_ch *ch,
struct srpt_recv_ioctx *recv_ioctx, struct srpt_recv_ioctx *recv_ioctx,
struct srpt_send_ioctx *send_ioctx) struct srpt_send_ioctx *send_ioctx)
{ {
struct se_cmd *cmd; struct se_cmd *cmd;
struct srp_cmd *srp_cmd; struct srp_cmd *srp_cmd;
u64 data_len; u64 data_len;
enum dma_data_direction dir; enum dma_data_direction dir;
sense_reason_t ret;
int rc; int rc;
BUG_ON(!send_ioctx); BUG_ON(!send_ioctx);
...@@ -1528,8 +1528,7 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch, ...@@ -1528,8 +1528,7 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
if (srpt_get_desc_tbl(send_ioctx, srp_cmd, &dir, &data_len)) { if (srpt_get_desc_tbl(send_ioctx, srp_cmd, &dir, &data_len)) {
pr_err("0x%llx: parsing SRP descriptor table failed.\n", pr_err("0x%llx: parsing SRP descriptor table failed.\n",
srp_cmd->tag); srp_cmd->tag);
ret = TCM_INVALID_CDB_FIELD; goto release_ioctx;
goto send_sense;
} }
rc = target_submit_cmd(cmd, ch->sess, srp_cmd->cdb, rc = target_submit_cmd(cmd, ch->sess, srp_cmd->cdb,
...@@ -1537,14 +1536,15 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch, ...@@ -1537,14 +1536,15 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
scsilun_to_int(&srp_cmd->lun), data_len, scsilun_to_int(&srp_cmd->lun), data_len,
TCM_SIMPLE_TAG, dir, TARGET_SCF_ACK_KREF); TCM_SIMPLE_TAG, dir, TARGET_SCF_ACK_KREF);
if (rc != 0) { if (rc != 0) {
ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; pr_debug("target_submit_cmd() returned %d for tag %#llx\n", rc,
goto send_sense; srp_cmd->tag);
goto release_ioctx;
} }
return 0; return;
send_sense: release_ioctx:
transport_send_check_condition_and_sense(cmd, ret, 0); send_ioctx->state = SRPT_STATE_DONE;
return -1; srpt_release_cmd(cmd);
} }
static int srp_tmr_to_tcm(int fn) static int srp_tmr_to_tcm(int fn)
......
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