Skip to content

Commit 3e4f574

Browse files
author
Nicholas Bellinger
committed
ib_srpt: Convert TMR path to target_submit_tmr
This patch converts the TMR path in srpt_handle_tsk_mgmt() to use target_submit_tmr() with TARGET_SCF_ACK_KREF flag usage. v2: Drop ununused res in target_submit_tmr (Fengguang.Wu) Cc: Christoph Hellwig <hch@lst.de> Cc: Bart Van Assche <bvanassche@acm.org> Cc: Roland Dreier <roland@kernel.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
1 parent 9474b04 commit 3e4f574

1 file changed

Lines changed: 18 additions & 19 deletions

File tree

‎drivers/infiniband/ulp/srpt/ib_srpt.c‎

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,9 +1825,11 @@ static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch,
18251825
{
18261826
struct srp_tsk_mgmt *srp_tsk;
18271827
struct se_cmd *cmd;
1828+
struct se_session *sess = ch->sess;
18281829
uint64_t unpacked_lun;
1830+
uint32_t tag = 0;
18291831
int tcm_tmr;
1830-
int res;
1832+
int rc;
18311833

18321834
BUG_ON(!send_ioctx);
18331835

@@ -1846,28 +1848,25 @@ static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch,
18461848
TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED;
18471849
goto fail;
18481850
}
1849-
transport_init_se_cmd(&send_ioctx->cmd, &srpt_target->tf_ops, ch->sess,
1850-
0, DMA_NONE, MSG_SIMPLE_TAG, send_ioctx->sense_data);
1851-
1852-
res = core_tmr_alloc_req(cmd, NULL, tcm_tmr, GFP_KERNEL);
1853-
if (res < 0) {
1854-
send_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED;
1855-
goto fail;
1856-
}
1857-
18581851
unpacked_lun = srpt_unpack_lun((uint8_t *)&srp_tsk->lun,
18591852
sizeof(srp_tsk->lun));
1860-
res = transport_lookup_tmr_lun(&send_ioctx->cmd, unpacked_lun);
1861-
if (res) {
1862-
pr_debug("rejecting TMR for LUN %lld\n", unpacked_lun);
1863-
send_ioctx->cmd.se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST;
1853+
1854+
if (srp_tsk->tsk_mgmt_func == SRP_TSK_ABORT_TASK) {
1855+
rc = srpt_rx_mgmt_fn_tag(send_ioctx, srp_tsk->task_tag);
1856+
if (rc < 0) {
1857+
send_ioctx->cmd.se_tmr_req->response =
1858+
TMR_TASK_DOES_NOT_EXIST;
1859+
goto fail;
1860+
}
1861+
tag = srp_tsk->task_tag;
1862+
}
1863+
rc = target_submit_tmr(&send_ioctx->cmd, sess, NULL, unpacked_lun,
1864+
srp_tsk, tcm_tmr, GFP_KERNEL, tag,
1865+
TARGET_SCF_ACK_KREF);
1866+
if (rc != 0) {
1867+
send_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED;
18641868
goto fail;
18651869
}
1866-
1867-
if (srp_tsk->tsk_mgmt_func == SRP_TSK_ABORT_TASK)
1868-
srpt_rx_mgmt_fn_tag(send_ioctx, srp_tsk->task_tag);
1869-
1870-
transport_generic_handle_tmr(&send_ioctx->cmd);
18711870
return;
18721871
fail:
18731872
transport_send_check_condition_and_sense(cmd, 0, 0); // XXX:

0 commit comments

Comments
 (0)