Commit 086a0dab authored by Dan Williams's avatar Dan Williams

isci: fix isci_task_execute_tmf completion

1/ fix the timeout for wait_for_completion_timeout
2/ In the tmf timeout case we need to wait for our termination callback
3/ Once the request is successfully started it will be freed according to the
   normal lifetime for requests.
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent e9bf7095
...@@ -339,7 +339,8 @@ int isci_task_execute_tmf(struct isci_host *ihost, ...@@ -339,7 +339,8 @@ int isci_task_execute_tmf(struct isci_host *ihost,
status, status,
ireq); ireq);
spin_unlock_irqrestore(&ihost->scic_lock, flags); spin_unlock_irqrestore(&ihost->scic_lock, flags);
goto cleanup_request; isci_request_free(ihost, ireq);
return ret;
} }
if (tmf->cb_state_func != NULL) if (tmf->cb_state_func != NULL)
...@@ -354,7 +355,7 @@ int isci_task_execute_tmf(struct isci_host *ihost, ...@@ -354,7 +355,7 @@ int isci_task_execute_tmf(struct isci_host *ihost,
/* Wait for the TMF to complete, or a timeout. */ /* Wait for the TMF to complete, or a timeout. */
timeleft = wait_for_completion_timeout(&completion, timeleft = wait_for_completion_timeout(&completion,
jiffies + msecs_to_jiffies(timeout_ms)); msecs_to_jiffies(timeout_ms));
if (timeleft == 0) { if (timeleft == 0) {
spin_lock_irqsave(&ihost->scic_lock, flags); spin_lock_irqsave(&ihost->scic_lock, flags);
...@@ -362,11 +363,13 @@ int isci_task_execute_tmf(struct isci_host *ihost, ...@@ -362,11 +363,13 @@ int isci_task_execute_tmf(struct isci_host *ihost,
if (tmf->cb_state_func != NULL) if (tmf->cb_state_func != NULL)
tmf->cb_state_func(isci_tmf_timed_out, tmf, tmf->cb_data); tmf->cb_state_func(isci_tmf_timed_out, tmf, tmf->cb_data);
status = scic_controller_terminate_request(&ihost->sci, scic_controller_terminate_request(&ihost->sci,
&isci_device->sci, &isci_device->sci,
&ireq->sci); &ireq->sci);
spin_unlock_irqrestore(&ihost->scic_lock, flags); spin_unlock_irqrestore(&ihost->scic_lock, flags);
wait_for_completion(tmf->complete);
} }
isci_print_tmf(tmf); isci_print_tmf(tmf);
...@@ -387,13 +390,6 @@ int isci_task_execute_tmf(struct isci_host *ihost, ...@@ -387,13 +390,6 @@ int isci_task_execute_tmf(struct isci_host *ihost,
__func__, __func__,
ireq); ireq);
if (ireq->io_request_completion != NULL) {
/* A thread is waiting for this TMF to finish. */
complete(ireq->io_request_completion);
}
cleanup_request:
isci_request_free(ihost, ireq);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment