summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsas/sas_event.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/libsas/sas_event.c')
-rw-r--r--drivers/scsi/libsas/sas_event.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/scsi/libsas/sas_event.c b/drivers/scsi/libsas/sas_event.c
index dbfaceeea0f7..16639bbae629 100644
--- a/drivers/scsi/libsas/sas_event.c
+++ b/drivers/scsi/libsas/sas_event.c
@@ -51,15 +51,11 @@ static void sas_queue_event(int event, unsigned long *pending,
}
}
-int sas_drain_work(struct sas_ha_struct *ha)
+
+void __sas_drain_work(struct sas_ha_struct *ha)
{
struct workqueue_struct *wq = ha->core.shost->work_q;
struct work_struct *w, *_w;
- int err;
-
- err = mutex_lock_interruptible(&ha->drain_mutex);
- if (err)
- return err;
set_bit(SAS_HA_DRAINING, &ha->state);
/* flush submitters */
@@ -75,6 +71,17 @@ int sas_drain_work(struct sas_ha_struct *ha)
sas_queue_work(ha, w);
}
spin_unlock_irq(&ha->state_lock);
+}
+
+int sas_drain_work(struct sas_ha_struct *ha)
+{
+ int err;
+
+ err = mutex_lock_interruptible(&ha->drain_mutex);
+ if (err)
+ return err;
+ if (test_bit(SAS_HA_REGISTERED, &ha->state))
+ __sas_drain_work(ha);
mutex_unlock(&ha->drain_mutex);
return 0;
OpenPOWER on IntegriCloud