aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/task.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2011-06-21 19:23:03 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:04:51 -0400
commit086a0dabc5bf154e13604a6d71e2d051207f9718 (patch)
tree1fbcde709c24fd5c5ebd8451b96e567ba5e1c1d4 /drivers/scsi/isci/task.c
parente9bf709564e90abea25ca7aeae8c3de5cc6468d7 (diff)
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: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/task.c')
-rw-r--r--drivers/scsi/isci/task.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c
index c313bc16c218..0835a2c2dc71 100644
--- a/drivers/scsi/isci/task.c
+++ b/drivers/scsi/isci/task.c
@@ -339,7 +339,8 @@ int isci_task_execute_tmf(struct isci_host *ihost,
339 status, 339 status,
340 ireq); 340 ireq);
341 spin_unlock_irqrestore(&ihost->scic_lock, flags); 341 spin_unlock_irqrestore(&ihost->scic_lock, flags);
342 goto cleanup_request; 342 isci_request_free(ihost, ireq);
343 return ret;
343 } 344 }
344 345
345 if (tmf->cb_state_func != NULL) 346 if (tmf->cb_state_func != NULL)
@@ -354,7 +355,7 @@ int isci_task_execute_tmf(struct isci_host *ihost,
354 355
355 /* Wait for the TMF to complete, or a timeout. */ 356 /* Wait for the TMF to complete, or a timeout. */
356 timeleft = wait_for_completion_timeout(&completion, 357 timeleft = wait_for_completion_timeout(&completion,
357 jiffies + msecs_to_jiffies(timeout_ms)); 358 msecs_to_jiffies(timeout_ms));
358 359
359 if (timeleft == 0) { 360 if (timeleft == 0) {
360 spin_lock_irqsave(&ihost->scic_lock, flags); 361 spin_lock_irqsave(&ihost->scic_lock, flags);
@@ -362,11 +363,13 @@ int isci_task_execute_tmf(struct isci_host *ihost,
362 if (tmf->cb_state_func != NULL) 363 if (tmf->cb_state_func != NULL)
363 tmf->cb_state_func(isci_tmf_timed_out, tmf, tmf->cb_data); 364 tmf->cb_state_func(isci_tmf_timed_out, tmf, tmf->cb_data);
364 365
365 status = scic_controller_terminate_request(&ihost->sci, 366 scic_controller_terminate_request(&ihost->sci,
366 &isci_device->sci, 367 &isci_device->sci,
367 &ireq->sci); 368 &ireq->sci);
368 369
369 spin_unlock_irqrestore(&ihost->scic_lock, flags); 370 spin_unlock_irqrestore(&ihost->scic_lock, flags);
371
372 wait_for_completion(tmf->complete);
370 } 373 }
371 374
372 isci_print_tmf(tmf); 375 isci_print_tmf(tmf);
@@ -387,13 +390,6 @@ int isci_task_execute_tmf(struct isci_host *ihost,
387 __func__, 390 __func__,
388 ireq); 391 ireq);
389 392
390 if (ireq->io_request_completion != NULL) {
391 /* A thread is waiting for this TMF to finish. */
392 complete(ireq->io_request_completion);
393 }
394
395 cleanup_request:
396 isci_request_free(ihost, ireq);
397 return ret; 393 return ret;
398} 394}
399 395