summaryrefslogtreecommitdiff
path: root/drivers/scsi/libsas/sas_init.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@us.ibm.com>2007-01-11 22:15:43 (GMT)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-01-13 22:21:53 (GMT)
commit6b0efb8516a5298e12033df61f9e0c376a306adb (patch)
tree3f63587167905e86de330fb28219dbfb309aad9a /drivers/scsi/libsas/sas_init.c
parent980fa2f9d64b9be96107c89e165953ace311af54 (diff)
downloadlinux-fsl-qoriq-6b0efb8516a5298e12033df61f9e0c376a306adb.tar.xz
[SCSI] libsas: Add SAS_HA state flags to avoid queueing events while unloading
Track sas_ha_struct state so that we ignore events that come in while we're shutting things down. Signed-off-by: Malahal Naineni <malahal@us.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/libsas/sas_init.c')
-rw-r--r--drivers/scsi/libsas/sas_init.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c
index 4df73d6..965698c 100644
--- a/drivers/scsi/libsas/sas_init.c
+++ b/drivers/scsi/libsas/sas_init.c
@@ -87,6 +87,9 @@ int sas_register_ha(struct sas_ha_struct *sas_ha)
else if (sas_ha->lldd_queue_size == -1)
sas_ha->lldd_queue_size = 128; /* Sanity */
+ sas_ha->state = SAS_HA_REGISTERED;
+ spin_lock_init(&sas_ha->state_lock);
+
error = sas_register_phys(sas_ha);
if (error) {
printk(KERN_NOTICE "couldn't register sas phys:%d\n", error);
@@ -127,6 +130,15 @@ Undo_phys:
int sas_unregister_ha(struct sas_ha_struct *sas_ha)
{
+ unsigned long flags;
+
+ /* Set the state to unregistered to avoid further
+ * events to be queued */
+ spin_lock_irqsave(&sas_ha->state_lock, flags);
+ sas_ha->state = SAS_HA_UNREGISTERED;
+ spin_unlock_irqrestore(&sas_ha->state_lock, flags);
+ scsi_flush_work(sas_ha->core.shost);
+
sas_unregister_ports(sas_ha);
if (sas_ha->lldd_max_execute_num > 1) {