diff options
author | Swen Schillig <swen@vnet.ibm.com> | 2009-11-24 10:53:58 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-12-04 13:02:01 -0500 |
commit | ecf0c7721b104c0ce9c8ca534c911f6310cf92a8 (patch) | |
tree | 639032b36bcbbe905c98c6f0b3b521dc2f0b1806 /drivers/s390/scsi/zfcp_sysfs.c | |
parent | 0a55256d158c18e4821c248a295b7f8f4423660f (diff) |
[SCSI] zfcp: Replace global config_lock with local list locks
The global config_lock was used to protect the configuration organized
in independent lists. It is not necessary to have a lock on driver
level for this purpose. This patch replaces the global config_lock
with a set of local list locks.
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 | 48 |
1 files changed, 20 insertions, 28 deletions
diff --git a/drivers/s390/scsi/zfcp_sysfs.c b/drivers/s390/scsi/zfcp_sysfs.c index d31000886ca8..8430b518357e 100644 --- a/drivers/s390/scsi/zfcp_sysfs.c +++ b/drivers/s390/scsi/zfcp_sysfs.c | |||
@@ -153,15 +153,14 @@ static ssize_t zfcp_sysfs_port_remove_store(struct device *dev, | |||
153 | goto out; | 153 | goto out; |
154 | } | 154 | } |
155 | 155 | ||
156 | write_lock_irq(&zfcp_data.config_lock); | ||
157 | port = zfcp_get_port_by_wwpn(adapter, wwpn); | 156 | port = zfcp_get_port_by_wwpn(adapter, wwpn); |
158 | if (port && (atomic_read(&port->refcount) == 0)) { | 157 | if (port && (atomic_read(&port->refcount) == 1)) { |
159 | zfcp_port_get(port); | ||
160 | atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status); | 158 | atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status); |
159 | write_lock_irq(&adapter->port_list_lock); | ||
161 | list_move(&port->list, &port_remove_lh); | 160 | list_move(&port->list, &port_remove_lh); |
161 | write_unlock_irq(&adapter->port_list_lock); | ||
162 | } else | 162 | } else |
163 | port = NULL; | 163 | port = NULL; |
164 | write_unlock_irq(&zfcp_data.config_lock); | ||
165 | 164 | ||
166 | if (!port) { | 165 | if (!port) { |
167 | retval = -ENXIO; | 166 | retval = -ENXIO; |
@@ -253,35 +252,28 @@ static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev, | |||
253 | goto out; | 252 | goto out; |
254 | } | 253 | } |
255 | 254 | ||
256 | write_lock_irq(&zfcp_data.config_lock); | ||
257 | unit = zfcp_get_unit_by_lun(port, fcp_lun); | 255 | unit = zfcp_get_unit_by_lun(port, fcp_lun); |
258 | if (unit) { | ||
259 | write_unlock_irq(&zfcp_data.config_lock); | ||
260 | /* wait for possible timeout during SCSI probe */ | ||
261 | flush_work(&unit->scsi_work); | ||
262 | write_lock_irq(&zfcp_data.config_lock); | ||
263 | |||
264 | if (atomic_read(&unit->refcount) == 0) { | ||
265 | zfcp_unit_get(unit); | ||
266 | atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, | ||
267 | &unit->status); | ||
268 | list_move(&unit->list, &unit_remove_lh); | ||
269 | } else { | ||
270 | unit = NULL; | ||
271 | } | ||
272 | } | ||
273 | |||
274 | write_unlock_irq(&zfcp_data.config_lock); | ||
275 | |||
276 | if (!unit) { | 256 | if (!unit) { |
277 | retval = -ENXIO; | 257 | retval = -EINVAL; |
278 | goto out; | 258 | goto out; |
279 | } | 259 | } |
280 | 260 | ||
281 | zfcp_erp_unit_shutdown(unit, 0, "syurs_1", NULL); | 261 | /* wait for possible timeout during SCSI probe */ |
282 | zfcp_erp_wait(unit->port->adapter); | 262 | flush_work(&unit->scsi_work); |
283 | zfcp_unit_put(unit); | 263 | |
284 | zfcp_unit_dequeue(unit); | 264 | if (atomic_read(&unit->refcount) == 1) { |
265 | atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status); | ||
266 | |||
267 | write_lock_irq(&port->unit_list_lock); | ||
268 | list_move(&unit->list, &unit_remove_lh); | ||
269 | write_unlock_irq(&port->unit_list_lock); | ||
270 | |||
271 | zfcp_erp_unit_shutdown(unit, 0, "syurs_1", NULL); | ||
272 | zfcp_erp_wait(unit->port->adapter); | ||
273 | zfcp_unit_put(unit); | ||
274 | zfcp_unit_dequeue(unit); | ||
275 | } else | ||
276 | zfcp_unit_put(unit); | ||
285 | out: | 277 | out: |
286 | mutex_unlock(&zfcp_data.config_mutex); | 278 | mutex_unlock(&zfcp_data.config_mutex); |
287 | return retval ? retval : (ssize_t) count; | 279 | return retval ? retval : (ssize_t) count; |