Skip to content

Commit 2c7f37f

Browse files
Bart Van Asschedledford
authored andcommitted
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 <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Alex Estrin <[email protected]> Cc: Sagi Grimberg <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent f108f0f commit 2c7f37f

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

drivers/infiniband/ulp/srpt/ib_srpt.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ MODULE_PARM_DESC(srpt_service_guid,
9191
" instead of using the node_guid of the first HCA.");
9292

9393
static struct ib_client srpt_client;
94+
static void srpt_release_cmd(struct se_cmd *se_cmd);
9495
static void srpt_release_channel(struct srpt_rdma_ch *ch);
9596
static int srpt_queue_status(struct se_cmd *cmd);
9697
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)
14921493
/**
14931494
* srpt_handle_cmd() - Process SRP_CMD.
14941495
*/
1495-
static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
1496-
struct srpt_recv_ioctx *recv_ioctx,
1497-
struct srpt_send_ioctx *send_ioctx)
1496+
static void srpt_handle_cmd(struct srpt_rdma_ch *ch,
1497+
struct srpt_recv_ioctx *recv_ioctx,
1498+
struct srpt_send_ioctx *send_ioctx)
14981499
{
14991500
struct se_cmd *cmd;
15001501
struct srp_cmd *srp_cmd;
15011502
u64 data_len;
15021503
enum dma_data_direction dir;
1503-
sense_reason_t ret;
15041504
int rc;
15051505

15061506
BUG_ON(!send_ioctx);
@@ -1528,23 +1528,23 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
15281528
if (srpt_get_desc_tbl(send_ioctx, srp_cmd, &dir, &data_len)) {
15291529
pr_err("0x%llx: parsing SRP descriptor table failed.\n",
15301530
srp_cmd->tag);
1531-
ret = TCM_INVALID_CDB_FIELD;
1532-
goto send_sense;
1531+
goto release_ioctx;
15331532
}
15341533

15351534
rc = target_submit_cmd(cmd, ch->sess, srp_cmd->cdb,
15361535
&send_ioctx->sense_data[0],
15371536
scsilun_to_int(&srp_cmd->lun), data_len,
15381537
TCM_SIMPLE_TAG, dir, TARGET_SCF_ACK_KREF);
15391538
if (rc != 0) {
1540-
ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
1541-
goto send_sense;
1539+
pr_debug("target_submit_cmd() returned %d for tag %#llx\n", rc,
1540+
srp_cmd->tag);
1541+
goto release_ioctx;
15421542
}
1543-
return 0;
1543+
return;
15441544

1545-
send_sense:
1546-
transport_send_check_condition_and_sense(cmd, ret, 0);
1547-
return -1;
1545+
release_ioctx:
1546+
send_ioctx->state = SRPT_STATE_DONE;
1547+
srpt_release_cmd(cmd);
15481548
}
15491549

15501550
static int srp_tmr_to_tcm(int fn)

0 commit comments

Comments
 (0)