aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/task.h
diff options
context:
space:
mode:
authorJeff Skirvin <jeffrey.d.skirvin@intel.com>2011-03-31 16:10:40 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:00:36 -0400
commited8a72d108bd951909b28fa4a89aad6489f414e1 (patch)
treed93a624b0677c756c77a2bf3846b69f6209221e8 /drivers/scsi/isci/task.h
parent26e953bc6ec11c9e81ad8e9a59b14cf260776007 (diff)
isci: Qualify when the host lock is managed for STP/SATA callbacks.
In the case of internal discovery related STP/SATA I/O started through sas_execute_task the host lock is not taken by libsas before calling lldd_execute_task, so the lock should not be managed before calling back to libsas through task->task_done or sas_task_abort. Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/task.h')
-rw-r--r--drivers/scsi/isci/task.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/scsi/isci/task.h b/drivers/scsi/isci/task.h
index d7cb6fe268c..c5afd1cfbde 100644
--- a/drivers/scsi/isci/task.h
+++ b/drivers/scsi/isci/task.h
@@ -56,6 +56,8 @@
56#if !defined(_ISCI_TASK_H_) 56#if !defined(_ISCI_TASK_H_)
57#define _ISCI_TASK_H_ 57#define _ISCI_TASK_H_
58 58
59#include <scsi/sas_ata.h>
60
59struct isci_request; 61struct isci_request;
60struct isci_host; 62struct isci_host;
61 63
@@ -332,5 +334,40 @@ isci_task_set_completion_status(
332 return task_notification_selection; 334 return task_notification_selection;
333 335
334} 336}
337/**
338* isci_execpath_callback() - This function is called from the task
339* execute path when the task needs to callback libsas about the submit-time
340* task failure. The callback occurs either through the task's done function
341* or through sas_task_abort. In the case of regular non-discovery SATA/STP I/O
342* requests, libsas takes the host lock before calling execute task. Therefore
343* in this situation the host lock must be managed before calling the func.
344*
345* @ihost: This parameter is the controller to which the I/O request was sent.
346* @task: This parameter is the I/O request.
347* @func: This parameter is the function to call in the correct context.
348* @status: This parameter is the status code for the completed task.
349*
350*/
351static inline void isci_execpath_callback(
352 struct isci_host *ihost,
353 struct sas_task *task,
354 void (*func)(struct sas_task *))
355{
356 unsigned long flags;
357
358 if (dev_is_sata(task->dev) && task->uldd_task) {
359 /* Since we are still in the submit path, and since
360 * libsas takes the host lock on behalf of SATA
361 * devices before I/O starts (in the non-discovery case),
362 * we need to unlock before we can call the callback function.
363 */
364 raw_local_irq_save(flags);
365 spin_unlock(ihost->shost->host_lock);
366 func(task);
367 spin_lock(ihost->shost->host_lock);
368 raw_local_irq_restore(flags);
369 } else
370 func(task);
371}
335 372
336#endif /* !defined(_SCI_TASK_H_) */ 373#endif /* !defined(_SCI_TASK_H_) */