[SCSI] zfcp: Defer resource allocation to first ccw_set_online call
So far, zfcp allocated all resources required for FCP
adapters/subchannels when the device was discovered in the ccw_probe
callback. If there are lots of unused FCP subchannels attached to a
system, this is a waste of resources. To alleviate this, defer the
resource allocation to the first call to ccw_set_online. To avoid
disruptions during possible following calls to ccw_set_offline and
then ccw_set_online, keep the adapter resources until the device is
finally being removed via ccw_remove. While doing this, also manage
the zfcp erp thread together with all other adapter resources in
zfcp_adapter_enqueue/dequeue.
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>
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index e8f39f0..d1e75d3 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -541,6 +541,9 @@
rwlock_init(&adapter->erp_lock);
rwlock_init(&adapter->abort_lock);
+ if (zfcp_erp_thread_setup(adapter))
+ goto erp_thread_failed;
+
INIT_WORK(&adapter->stat_work, _zfcp_status_read_scheduler);
INIT_WORK(&adapter->scan_work, _zfcp_fc_scan_ports_later);
@@ -561,6 +564,8 @@
return 0;
sysfs_failed:
+ zfcp_erp_thread_kill(adapter);
+erp_thread_failed:
zfcp_fc_gs_destroy(adapter);
generic_services_failed:
zfcp_destroy_adapter_work_queue(adapter);
@@ -602,6 +607,7 @@
return;
zfcp_fc_gs_destroy(adapter);
+ zfcp_erp_thread_kill(adapter);
zfcp_destroy_adapter_work_queue(adapter);
zfcp_dbf_adapter_unregister(adapter->dbf);
zfcp_free_low_mem_buffers(adapter);