diff options
author | Bart Van Assche <bart.vanassche@sandisk.com> | 2017-05-23 19:48:41 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2017-07-07 02:11:25 -0400 |
commit | 75f141aaf48e13812b4fee914a66f6fce28b543f (patch) | |
tree | 3ecfd65403e2abfbe710ed9113cb5b81a9a7ab20 | |
parent | d17203c41185a05ecd4d1fc647f16b17ab1b27ae (diff) |
target/tcm_loop: Use target_submit_tmr() instead of open-coding this function
Use target_submit_tmr() instead of open-coding this function. The
only functional change is that TMFs are now added to sess_cmd_list,
something the current code does not do. This behavior change is a
bug fix because it makes LUN RESETs wait for other TMFs that are in
progress for the same LUN.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Cc: David Disseldorp <ddiss@suse.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r-- | drivers/target/loopback/tcm_loop.c | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 27f912747113..8cf556b4c5ca 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c | |||
@@ -218,7 +218,6 @@ static int tcm_loop_issue_tmr(struct tcm_loop_tpg *tl_tpg, | |||
218 | { | 218 | { |
219 | struct se_cmd *se_cmd = NULL; | 219 | struct se_cmd *se_cmd = NULL; |
220 | struct se_session *se_sess; | 220 | struct se_session *se_sess; |
221 | struct se_portal_group *se_tpg; | ||
222 | struct tcm_loop_nexus *tl_nexus; | 221 | struct tcm_loop_nexus *tl_nexus; |
223 | struct tcm_loop_cmd *tl_cmd = NULL; | 222 | struct tcm_loop_cmd *tl_cmd = NULL; |
224 | int ret = TMR_FUNCTION_FAILED, rc; | 223 | int ret = TMR_FUNCTION_FAILED, rc; |
@@ -242,40 +241,15 @@ static int tcm_loop_issue_tmr(struct tcm_loop_tpg *tl_tpg, | |||
242 | init_completion(&tl_cmd->tmr_done); | 241 | init_completion(&tl_cmd->tmr_done); |
243 | 242 | ||
244 | se_cmd = &tl_cmd->tl_se_cmd; | 243 | se_cmd = &tl_cmd->tl_se_cmd; |
245 | se_tpg = &tl_tpg->tl_se_tpg; | ||
246 | se_sess = tl_tpg->tl_nexus->se_sess; | 244 | se_sess = tl_tpg->tl_nexus->se_sess; |
247 | /* | ||
248 | * Initialize struct se_cmd descriptor from target_core_mod infrastructure | ||
249 | */ | ||
250 | transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess, 0, | ||
251 | DMA_NONE, TCM_SIMPLE_TAG, | ||
252 | &tl_cmd->tl_sense_buf[0]); | ||
253 | 245 | ||
254 | rc = core_tmr_alloc_req(se_cmd, NULL, tmr, GFP_KERNEL); | 246 | rc = target_submit_tmr(se_cmd, se_sess, tl_cmd->tl_sense_buf, lun, |
247 | NULL, tmr, GFP_KERNEL, task, 0 /*flags*/); | ||
255 | if (rc < 0) | 248 | if (rc < 0) |
256 | goto release; | 249 | goto release; |
257 | |||
258 | if (tmr == TMR_ABORT_TASK) | ||
259 | se_cmd->se_tmr_req->ref_task_tag = task; | ||
260 | |||
261 | /* | ||
262 | * Locate the underlying TCM struct se_lun | ||
263 | */ | ||
264 | if (transport_lookup_tmr_lun(se_cmd, lun) < 0) { | ||
265 | ret = TMR_LUN_DOES_NOT_EXIST; | ||
266 | goto release; | ||
267 | } | ||
268 | /* | ||
269 | * Queue the TMR to TCM Core and sleep waiting for | ||
270 | * tcm_loop_queue_tm_rsp() to wake us up. | ||
271 | */ | ||
272 | transport_generic_handle_tmr(se_cmd); | ||
273 | wait_for_completion(&tl_cmd->tmr_done); | 250 | wait_for_completion(&tl_cmd->tmr_done); |
274 | /* | ||
275 | * The TMR LUN_RESET has completed, check the response status and | ||
276 | * then release allocations. | ||
277 | */ | ||
278 | ret = se_cmd->se_tmr_req->response; | 251 | ret = se_cmd->se_tmr_req->response; |
252 | |||
279 | release: | 253 | release: |
280 | if (se_cmd) | 254 | if (se_cmd) |
281 | transport_generic_free_cmd(se_cmd, 1); | 255 | transport_generic_free_cmd(se_cmd, 1); |