Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: libsas: use flush_workqueue to process disco events synchronously

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>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Jason Yan and committed by
Martin K. Petersen
517e5153 93bdbd06

+4
+4
drivers/scsi/libsas/sas_port.c
··· 192 192 si->dft->lldd_port_formed(phy); 193 193 194 194 sas_discover_event(phy->port, DISCE_DISCOVER_DOMAIN); 195 + flush_workqueue(sas_ha->disco_q); 195 196 } 196 197 197 198 /** ··· 278 277 279 278 SAS_DPRINTK("broadcast received: %d\n", prim); 280 279 sas_discover_event(phy->port, DISCE_REVALIDATE_DOMAIN); 280 + 281 + if (phy->port) 282 + flush_workqueue(phy->port->ha->disco_q); 281 283 } 282 284 283 285 void sas_porte_link_reset_err(struct work_struct *work)