aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/libsas.h
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2011-11-28 14:29:20 -0500
committerJames Bottomley <JBottomley@Parallels.com>2012-02-19 15:06:08 -0500
commit9095a64a9aead653df320e3a6fc70835c15d46e4 (patch)
tree63ad804f78668bf28d90ea2f8c9640ce92dacdea /include/scsi/libsas.h
parenta3a142524aa4b1539a64a55087bf12ffa4b1f94e (diff)
[SCSI] libsas: fix timeout vs completion race
Until we have told the lldd to forget a task a timed out operation can return from the hardware at any time. Since completion frees the task we need to make sure that no tasks run their normal completion handler once eh has decided to manage the task. Similar to ata_scsi_cmd_error_handler() freeze completions to let eh judge the outcome of the race. Task collector mode is problematic because it presents a situation where a task can be timed out and aborted before the lldd has even seen it. For this case we need to guarantee that a task that an lldd has been told to forget does not get queued after the lldd says "never seen it". With sas_scsi_timed_out we achieve this with the ->task_queue_flush mutex, rather than adding more time. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'include/scsi/libsas.h')
-rw-r--r--include/scsi/libsas.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 071041b290d6..aa7192ff4355 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -178,6 +178,7 @@ enum {
178}; 178};
179 179
180struct domain_device { 180struct domain_device {
181 spinlock_t done_lock;
181 enum sas_dev_type dev_type; 182 enum sas_dev_type dev_type;
182 183
183 enum sas_linkrate linkrate; 184 enum sas_linkrate linkrate;
@@ -321,6 +322,7 @@ struct asd_sas_phy {
321struct scsi_core { 322struct scsi_core {
322 struct Scsi_Host *shost; 323 struct Scsi_Host *shost;
323 324
325 struct mutex task_queue_flush;
324 spinlock_t task_queue_lock; 326 spinlock_t task_queue_lock;
325 struct list_head task_queue; 327 struct list_head task_queue;
326 int task_queue_size; 328 int task_queue_size;
@@ -337,6 +339,7 @@ enum sas_ha_state {
337 SAS_HA_REGISTERED, 339 SAS_HA_REGISTERED,
338 SAS_HA_DRAINING, 340 SAS_HA_DRAINING,
339 SAS_HA_ATA_EH_ACTIVE, 341 SAS_HA_ATA_EH_ACTIVE,
342 SAS_HA_FROZEN,
340}; 343};
341 344
342struct sas_ha_struct { 345struct sas_ha_struct {