aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsas/sas_init.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2012-06-22 02:25:27 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-07-20 03:58:45 -0400
commite4a9c3732cea3e3c8c704aad86636090ffe6b25f (patch)
treefaea8e91b3d917dcdb4c89adbb021ac737a6cb35 /drivers/scsi/libsas/sas_init.c
parent3b661a92e869ebe2358de8f4b3230ad84f7fce51 (diff)
[SCSI] libata, libsas: introduce sched_eh and end_eh port ops
When managing shost->host_eh_scheduled libata assumes that there is a 1:1 shost-to-ata_port relationship. libsas creates a 1:N relationship so it needs to manage host_eh_scheduled cumulatively at the host level. The sched_eh and end_eh port port ops allow libsas to track when domain devices enter/leave the "eh-pending" state under ha->lock (previously named ha->state_lock, but it is no longer just a lock for ha->state changes). Since host_eh_scheduled indicates eh without backing commands pinning the device it can be deallocated at any time. Move the taking of the domain_device reference under the port_lock to guarantee that the ata_port stays around for the duration of eh. Reviewed-by: Jacek Danecki <jacek.danecki@intel.com> Acked-by: Jeff Garzik <jgarzik@redhat.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/libsas/sas_init.c')
-rw-r--r--drivers/scsi/libsas/sas_init.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c
index 10cb5ae30977..6909fefa32c5 100644
--- a/drivers/scsi/libsas/sas_init.c
+++ b/drivers/scsi/libsas/sas_init.c
@@ -114,7 +114,7 @@ int sas_register_ha(struct sas_ha_struct *sas_ha)
114 sas_ha->lldd_queue_size = 128; /* Sanity */ 114 sas_ha->lldd_queue_size = 128; /* Sanity */
115 115
116 set_bit(SAS_HA_REGISTERED, &sas_ha->state); 116 set_bit(SAS_HA_REGISTERED, &sas_ha->state);
117 spin_lock_init(&sas_ha->state_lock); 117 spin_lock_init(&sas_ha->lock);
118 mutex_init(&sas_ha->drain_mutex); 118 mutex_init(&sas_ha->drain_mutex);
119 INIT_LIST_HEAD(&sas_ha->defer_q); 119 INIT_LIST_HEAD(&sas_ha->defer_q);
120 120
@@ -163,9 +163,9 @@ int sas_unregister_ha(struct sas_ha_struct *sas_ha)
163 * events to be queued, and flush any in-progress drainers 163 * events to be queued, and flush any in-progress drainers
164 */ 164 */
165 mutex_lock(&sas_ha->drain_mutex); 165 mutex_lock(&sas_ha->drain_mutex);
166 spin_lock_irq(&sas_ha->state_lock); 166 spin_lock_irq(&sas_ha->lock);
167 clear_bit(SAS_HA_REGISTERED, &sas_ha->state); 167 clear_bit(SAS_HA_REGISTERED, &sas_ha->state);
168 spin_unlock_irq(&sas_ha->state_lock); 168 spin_unlock_irq(&sas_ha->lock);
169 __sas_drain_work(sas_ha); 169 __sas_drain_work(sas_ha);
170 mutex_unlock(&sas_ha->drain_mutex); 170 mutex_unlock(&sas_ha->drain_mutex);
171 171
@@ -411,9 +411,9 @@ static int queue_phy_reset(struct sas_phy *phy, int hard_reset)
411 d->reset_result = 0; 411 d->reset_result = 0;
412 d->hard_reset = hard_reset; 412 d->hard_reset = hard_reset;
413 413
414 spin_lock_irq(&ha->state_lock); 414 spin_lock_irq(&ha->lock);
415 sas_queue_work(ha, &d->reset_work); 415 sas_queue_work(ha, &d->reset_work);
416 spin_unlock_irq(&ha->state_lock); 416 spin_unlock_irq(&ha->lock);
417 417
418 rc = sas_drain_work(ha); 418 rc = sas_drain_work(ha);
419 if (rc == 0) 419 if (rc == 0)
@@ -438,9 +438,9 @@ static int queue_phy_enable(struct sas_phy *phy, int enable)
438 d->enable_result = 0; 438 d->enable_result = 0;
439 d->enable = enable; 439 d->enable = enable;
440 440
441 spin_lock_irq(&ha->state_lock); 441 spin_lock_irq(&ha->lock);
442 sas_queue_work(ha, &d->enable_work); 442 sas_queue_work(ha, &d->enable_work);
443 spin_unlock_irq(&ha->state_lock); 443 spin_unlock_irq(&ha->lock);
444 444
445 rc = sas_drain_work(ha); 445 rc = sas_drain_work(ha);
446 if (rc == 0) 446 if (rc == 0)