diff options
author | Swen Schillig <swen@vnet.ibm.com> | 2009-11-24 16:54:06 +0100 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-12-04 12:02:08 -0600 |
commit | 9eae07ef6bb5988163d8bb82cd952905db47b721 (patch) | |
tree | 97a7f5c98c760b6232e5cdb60e5da58414079981 /drivers/s390/scsi/zfcp_sysfs.c | |
parent | 6b183334c23969d52d4d9f775da554480d05ca4d (diff) |
[SCSI] zfcp: Assign scheduled work to driver queue
The port_scan work was scheduled to the work_queue provided by the
kernel. This resulted on SMP systems to a likely situation that more
than one scan_work were processed in parallel. This is not required
and openes the possibility of race conditions between the removal of
invalid ports and the enqueue of just scanned ports. This patch
synchronizes the scan_work tasks by scheduling them to adapter local
work_queue.
Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/s390/scsi/zfcp_sysfs.c')
-rw-r--r-- | drivers/s390/scsi/zfcp_sysfs.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/s390/scsi/zfcp_sysfs.c b/drivers/s390/scsi/zfcp_sysfs.c index 35e920b4fd8..f539e006683 100644 --- a/drivers/s390/scsi/zfcp_sysfs.c +++ b/drivers/s390/scsi/zfcp_sysfs.c @@ -184,15 +184,16 @@ static ssize_t zfcp_sysfs_port_rescan_store(struct device *dev, { struct ccw_device *cdev = to_ccwdev(dev); struct zfcp_adapter *adapter = zfcp_ccw_adapter_by_cdev(cdev); - int ret; if (!adapter) return -ENODEV; - ret = zfcp_fc_scan_ports(adapter); + /* sync the user-space- with the kernel-invocation of scan_work */ + queue_work(adapter->work_queue, &adapter->scan_work); + flush_work(&adapter->scan_work); zfcp_ccw_adapter_put(adapter); - return ret ? ret : (ssize_t) count; + return (ssize_t) count; } static ZFCP_DEV_ATTR(adapter, port_rescan, S_IWUSR, NULL, zfcp_sysfs_port_rescan_store); |