Not every Task Management failure is due to TMR_LUN_DOES_NOT_EXIST, which is currently being set if target_complete_tmr_failure() is executed. Only set this response where it should apply. Signed-off-by: Thinh Nguyen <Thinh.Nguyen@xxxxxxxxxxxx> --- drivers/target/target_core_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 2fc4ba1814c6..930bf8779d87 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1916,7 +1916,6 @@ static void target_complete_tmr_failure(struct work_struct *work) { struct se_cmd *se_cmd = container_of(work, struct se_cmd, work); - se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST; se_cmd->se_tfo->queue_tm_rsp(se_cmd); transport_lun_remove_cmd(se_cmd); @@ -1983,6 +1982,7 @@ int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, * to process context with TMR_LUN_DOES_NOT_EXIST status. */ failure: + se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST; INIT_WORK(&se_cmd->work, target_complete_tmr_failure); schedule_work(&se_cmd->work); return 0; -- 2.28.0