diff mbox

[v5,5/7] scsi: libsas: use flush_workqueue to process disco events synchronously

Message ID 20171208094210.24887-6-yanaijie@huawei.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Jason Yan Dec. 8, 2017, 9:42 a.m. UTC
Now we are processing sas event and discover event in different workqueues.
It's safe to wait the discover event done in the sas event work. Use
flush_workqueue() to insure the disco and revalidate events processed
synchronously so that the whole discover and revalidate process will not
be interrupted by other events.

Signed-off-by: Jason Yan <yanaijie@huawei.com>
CC: John Garry <john.garry@huawei.com>
CC: Johannes Thumshirn <jthumshirn@suse.de>
CC: Ewan Milne <emilne@redhat.com>
CC: Christoph Hellwig <hch@lst.de>
CC: Tomas Henzl <thenzl@redhat.com>
CC: Dan Williams <dan.j.williams@intel.com>
---
 drivers/scsi/libsas/sas_port.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Hannes Reinecke Dec. 15, 2017, 12:21 p.m. UTC | #1
On 12/08/2017 10:42 AM, Jason Yan wrote:
> Now we are processing sas event and discover event in different workqueues.
> It's safe to wait the discover event done in the sas event work. Use
> flush_workqueue() to insure the disco and revalidate events processed
> synchronously so that the whole discover and revalidate process will not
> be interrupted by other events.
> 
> Signed-off-by: Jason Yan <yanaijie@huawei.com>
> CC: John Garry <john.garry@huawei.com>
> CC: Johannes Thumshirn <jthumshirn@suse.de>
> CC: Ewan Milne <emilne@redhat.com>
> CC: Christoph Hellwig <hch@lst.de>
> CC: Tomas Henzl <thenzl@redhat.com>
> CC: Dan Williams <dan.j.williams@intel.com>
> ---
>  drivers/scsi/libsas/sas_port.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c
> index 9326628..64722f4 100644
> --- a/drivers/scsi/libsas/sas_port.c
> +++ b/drivers/scsi/libsas/sas_port.c
> @@ -192,6 +192,7 @@ static void sas_form_port(struct asd_sas_phy *phy)
>  		si->dft->lldd_port_formed(phy);
>  
>  	sas_discover_event(phy->port, DISCE_DISCOVER_DOMAIN);
> +	flush_workqueue(sas_ha->disco_q);
>  }
>  
>  /**
> @@ -277,6 +278,9 @@ void sas_porte_broadcast_rcvd(struct work_struct *work)
>  
>  	SAS_DPRINTK("broadcast received: %d\n", prim);
>  	sas_discover_event(phy->port, DISCE_REVALIDATE_DOMAIN);
> +
> +	if (phy->port)
> +		flush_workqueue(phy->port->ha->disco_q);
>  }
>  
>  void sas_porte_link_reset_err(struct work_struct *work)
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
diff mbox

Patch

diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c
index 9326628..64722f4 100644
--- a/drivers/scsi/libsas/sas_port.c
+++ b/drivers/scsi/libsas/sas_port.c
@@ -192,6 +192,7 @@  static void sas_form_port(struct asd_sas_phy *phy)
 		si->dft->lldd_port_formed(phy);
 
 	sas_discover_event(phy->port, DISCE_DISCOVER_DOMAIN);
+	flush_workqueue(sas_ha->disco_q);
 }
 
 /**
@@ -277,6 +278,9 @@  void sas_porte_broadcast_rcvd(struct work_struct *work)
 
 	SAS_DPRINTK("broadcast received: %d\n", prim);
 	sas_discover_event(phy->port, DISCE_REVALIDATE_DOMAIN);
+
+	if (phy->port)
+		flush_workqueue(phy->port->ha->disco_q);
 }
 
 void sas_porte_link_reset_err(struct work_struct *work)