aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@sandisk.com>2016-02-11 14:06:55 -0500
committerDoug Ledford <dledford@redhat.com>2016-02-29 17:12:35 -0500
commit2c7f37ff1c33087b8a4567730ebb128e8572da5e (patch)
treeffc71b886d8bf73524f8a19837b4ab22b9698572
parentf108f0f66a1f01ab077a88b1da2e2f092acd4b14 (diff)
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: Bart Van Assche <bart.vanassche@sandisk.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Alex Estrin <alex.estrin@intel.com> Cc: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/ulp/srpt/ib_srpt.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index d6446068e884..5b0fbc1bfce2 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -91,6 +91,7 @@ MODULE_PARM_DESC(srpt_service_guid,
91 " instead of using the node_guid of the first HCA."); 91 " instead of using the node_guid of the first HCA.");
92 92
93static struct ib_client srpt_client; 93static struct ib_client srpt_client;
94static void srpt_release_cmd(struct se_cmd *se_cmd);
94static void srpt_release_channel(struct srpt_rdma_ch *ch); 95static void srpt_release_channel(struct srpt_rdma_ch *ch);
95static int srpt_queue_status(struct se_cmd *cmd); 96static int srpt_queue_status(struct se_cmd *cmd);
96static void srpt_recv_done(struct ib_cq *cq, struct ib_wc *wc); 97static 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/** 1493/**
1493 * srpt_handle_cmd() - Process SRP_CMD. 1494 * srpt_handle_cmd() - Process SRP_CMD.
1494 */ 1495 */
1495static int srpt_handle_cmd(struct srpt_rdma_ch *ch, 1496static void srpt_handle_cmd(struct srpt_rdma_ch *ch,
1496 struct srpt_recv_ioctx *recv_ioctx, 1497 struct srpt_recv_ioctx *recv_ioctx,
1497 struct srpt_send_ioctx *send_ioctx) 1498 struct srpt_send_ioctx *send_ioctx)
1498{ 1499{
1499 struct se_cmd *cmd; 1500 struct se_cmd *cmd;
1500 struct srp_cmd *srp_cmd; 1501 struct srp_cmd *srp_cmd;
1501 u64 data_len; 1502 u64 data_len;
1502 enum dma_data_direction dir; 1503 enum dma_data_direction dir;
1503 sense_reason_t ret;
1504 int rc; 1504 int rc;
1505 1505
1506 BUG_ON(!send_ioctx); 1506 BUG_ON(!send_ioctx);
@@ -1528,8 +1528,7 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
1528 if (srpt_get_desc_tbl(send_ioctx, srp_cmd, &dir, &data_len)) { 1528 if (srpt_get_desc_tbl(send_ioctx, srp_cmd, &dir, &data_len)) {
1529 pr_err("0x%llx: parsing SRP descriptor table failed.\n", 1529 pr_err("0x%llx: parsing SRP descriptor table failed.\n",
1530 srp_cmd->tag); 1530 srp_cmd->tag);
1531 ret = TCM_INVALID_CDB_FIELD; 1531 goto release_ioctx;
1532 goto send_sense;
1533 } 1532 }
1534 1533
1535 rc = target_submit_cmd(cmd, ch->sess, srp_cmd->cdb, 1534 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 scsilun_to_int(&srp_cmd->lun), data_len, 1536 scsilun_to_int(&srp_cmd->lun), data_len,
1538 TCM_SIMPLE_TAG, dir, TARGET_SCF_ACK_KREF); 1537 TCM_SIMPLE_TAG, dir, TARGET_SCF_ACK_KREF);
1539 if (rc != 0) { 1538 if (rc != 0) {
1540 ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 1539 pr_debug("target_submit_cmd() returned %d for tag %#llx\n", rc,
1541 goto send_sense; 1540 srp_cmd->tag);
1541 goto release_ioctx;
1542 } 1542 }
1543 return 0; 1543 return;
1544 1544
1545send_sense: 1545release_ioctx:
1546 transport_send_check_condition_and_sense(cmd, ret, 0); 1546 send_ioctx->state = SRPT_STATE_DONE;
1547 return -1; 1547 srpt_release_cmd(cmd);
1548} 1548}
1549 1549
1550static int srp_tmr_to_tcm(int fn) 1550static int srp_tmr_to_tcm(int fn)