aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2010-07-16 09:37:35 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-28 10:48:46 -0400
commit1bf3ff02ca6247b2d7c9ebda93002392bf60a61d (patch)
tree569683190acd2ac3da8489bdcbd0f25f80c73b3e /drivers/s390
parent674c3a993c278b7469e1cf12bfc13e6838dfd877 (diff)
[SCSI] zfcp: Remove SCSI device when removing unit
Configuring a LUN in zfcp, also creates a SCSI device. For consistency, it makes sense to remove the SCSI device when the LUN is deconfigured. Replace the flush_work with the call to scsi_remove_device: scsi_remove_device also takes the scan_mutex that synchronizes itself with any long running device discovery. Reviewed-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')
-rw-r--r--drivers/s390/scsi/zfcp_def.h1
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c1
-rw-r--r--drivers/s390/scsi/zfcp_sysfs.c10
3 files changed, 10 insertions, 2 deletions
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 9fa1b064893e..86a8725430a4 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -212,6 +212,7 @@ struct zfcp_port {
212 struct work_struct test_link_work; 212 struct work_struct test_link_work;
213 struct work_struct rport_work; 213 struct work_struct rport_work;
214 enum { RPORT_NONE, RPORT_ADD, RPORT_DEL } rport_task; 214 enum { RPORT_NONE, RPORT_ADD, RPORT_DEL } rport_task;
215 unsigned int starget_id;
215}; 216};
216 217
217struct zfcp_unit { 218struct zfcp_unit {
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 4cab33a2f7be..9d117ee7159a 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -564,6 +564,7 @@ static void zfcp_scsi_rport_register(struct zfcp_port *port)
564 rport->maxframe_size = port->maxframe_size; 564 rport->maxframe_size = port->maxframe_size;
565 rport->supported_classes = port->supported_classes; 565 rport->supported_classes = port->supported_classes;
566 port->rport = rport; 566 port->rport = rport;
567 port->starget_id = rport->scsi_target_id;
567 568
568 zfcp_scsi_queue_unit_register(port); 569 zfcp_scsi_queue_unit_register(port);
569} 570}
diff --git a/drivers/s390/scsi/zfcp_sysfs.c b/drivers/s390/scsi/zfcp_sysfs.c
index 205b9f8056e2..b4561c86e230 100644
--- a/drivers/s390/scsi/zfcp_sysfs.c
+++ b/drivers/s390/scsi/zfcp_sysfs.c
@@ -290,6 +290,7 @@ static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev,
290 struct zfcp_unit *unit; 290 struct zfcp_unit *unit;
291 u64 fcp_lun; 291 u64 fcp_lun;
292 int retval = -EINVAL; 292 int retval = -EINVAL;
293 struct scsi_device *sdev;
293 294
294 if (!(port && get_device(&port->dev))) 295 if (!(port && get_device(&port->dev)))
295 return -EBUSY; 296 return -EBUSY;
@@ -303,8 +304,13 @@ static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev,
303 else 304 else
304 retval = 0; 305 retval = 0;
305 306
306 /* wait for possible timeout during SCSI probe */ 307 sdev = scsi_device_lookup(port->adapter->scsi_host, 0,
307 flush_work(&unit->scsi_work); 308 port->starget_id,
309 scsilun_to_int((struct scsi_lun *)&fcp_lun));
310 if (sdev) {
311 scsi_remove_device(sdev);
312 scsi_device_put(sdev);
313 }
308 314
309 write_lock_irq(&port->unit_list_lock); 315 write_lock_irq(&port->unit_list_lock);
310 list_del(&unit->list); 316 list_del(&unit->list);