aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_scsi.c
diff options
context:
space:
mode:
authorAndreas Herrmann <aherrman@de.ibm.com>2005-08-27 14:07:54 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-08-27 14:22:36 -0400
commit3859f6a248cbdfbe7b41663f3a2b51f48e30b281 (patch)
treea0f09490a7295bab3d299efdae5bd29c55c58c3a /drivers/s390/scsi/zfcp_scsi.c
parent729d70f5dfd663b44bca68a4479c96bde7e535d6 (diff)
[PATCH] zfcp: add rports to enable scsi_add_device to work again
This patch fixes a severe problem with 2.6.13-rc7. Due to recent SCSI changes it is not possible to add any LUNs to the zfcp device driver anymore. With registration of remote ports this is fixed. Signed-off-by: Andreas Herrmann <aherrman@de.ibm.com> Acked-by: James Bottomley <jejb@steeleye.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/s390/scsi/zfcp_scsi.c')
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index b61d309352c3..31a76065cf28 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -389,7 +389,7 @@ zfcp_unit_lookup(struct zfcp_adapter *adapter, int channel, scsi_id_t id,
389 struct zfcp_unit *unit, *retval = NULL; 389 struct zfcp_unit *unit, *retval = NULL;
390 390
391 list_for_each_entry(port, &adapter->port_list_head, list) { 391 list_for_each_entry(port, &adapter->port_list_head, list) {
392 if (id != port->scsi_id) 392 if (!port->rport || (id != port->rport->scsi_target_id))
393 continue; 393 continue;
394 list_for_each_entry(unit, &port->unit_list_head, list) { 394 list_for_each_entry(unit, &port->unit_list_head, list) {
395 if (lun == unit->scsi_lun) { 395 if (lun == unit->scsi_lun) {
@@ -408,7 +408,7 @@ zfcp_port_lookup(struct zfcp_adapter *adapter, int channel, scsi_id_t id)
408 struct zfcp_port *port; 408 struct zfcp_port *port;
409 409
410 list_for_each_entry(port, &adapter->port_list_head, list) { 410 list_for_each_entry(port, &adapter->port_list_head, list) {
411 if (id == port->scsi_id) 411 if (port->rport && (id == port->rport->scsi_target_id))
412 return port; 412 return port;
413 } 413 }
414 return (struct zfcp_port *) NULL; 414 return (struct zfcp_port *) NULL;
@@ -634,7 +634,6 @@ zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *scpnt)
634{ 634{
635 int retval; 635 int retval;
636 struct zfcp_unit *unit = (struct zfcp_unit *) scpnt->device->hostdata; 636 struct zfcp_unit *unit = (struct zfcp_unit *) scpnt->device->hostdata;
637 struct Scsi_Host *scsi_host = scpnt->device->host;
638 637
639 if (!unit) { 638 if (!unit) {
640 ZFCP_LOG_NORMAL("bug: Tried reset for nonexistent unit\n"); 639 ZFCP_LOG_NORMAL("bug: Tried reset for nonexistent unit\n");
@@ -729,7 +728,6 @@ zfcp_scsi_eh_bus_reset_handler(struct scsi_cmnd *scpnt)
729{ 728{
730 int retval = 0; 729 int retval = 0;
731 struct zfcp_unit *unit; 730 struct zfcp_unit *unit;
732 struct Scsi_Host *scsi_host = scpnt->device->host;
733 731
734 unit = (struct zfcp_unit *) scpnt->device->hostdata; 732 unit = (struct zfcp_unit *) scpnt->device->hostdata;
735 ZFCP_LOG_NORMAL("bus reset because of problems with " 733 ZFCP_LOG_NORMAL("bus reset because of problems with "
@@ -753,7 +751,6 @@ zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
753{ 751{
754 int retval = 0; 752 int retval = 0;
755 struct zfcp_unit *unit; 753 struct zfcp_unit *unit;
756 struct Scsi_Host *scsi_host = scpnt->device->host;
757 754
758 unit = (struct zfcp_unit *) scpnt->device->hostdata; 755 unit = (struct zfcp_unit *) scpnt->device->hostdata;
759 ZFCP_LOG_NORMAL("host reset because of problems with " 756 ZFCP_LOG_NORMAL("host reset because of problems with "
@@ -833,6 +830,7 @@ zfcp_adapter_scsi_unregister(struct zfcp_adapter *adapter)
833 shost = adapter->scsi_host; 830 shost = adapter->scsi_host;
834 if (!shost) 831 if (!shost)
835 return; 832 return;
833 fc_remove_host(shost);
836 scsi_remove_host(shost); 834 scsi_remove_host(shost);
837 scsi_host_put(shost); 835 scsi_host_put(shost);
838 adapter->scsi_host = NULL; 836 adapter->scsi_host = NULL;
@@ -906,6 +904,18 @@ zfcp_get_node_name(struct scsi_target *starget)
906 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 904 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
907} 905}
908 906
907void
908zfcp_set_fc_host_attrs(struct zfcp_adapter *adapter)
909{
910 struct Scsi_Host *shost = adapter->scsi_host;
911
912 fc_host_node_name(shost) = adapter->wwnn;
913 fc_host_port_name(shost) = adapter->wwpn;
914 strncpy(fc_host_serial_number(shost), adapter->serial_number,
915 min(FC_SERIAL_NUMBER_SIZE, 32));
916 fc_host_supported_classes(shost) = FC_COS_CLASS2 | FC_COS_CLASS3;
917}
918
909struct fc_function_template zfcp_transport_functions = { 919struct fc_function_template zfcp_transport_functions = {
910 .get_starget_port_id = zfcp_get_port_id, 920 .get_starget_port_id = zfcp_get_port_id,
911 .get_starget_port_name = zfcp_get_port_name, 921 .get_starget_port_name = zfcp_get_port_name,
@@ -913,6 +923,11 @@ struct fc_function_template zfcp_transport_functions = {
913 .show_starget_port_id = 1, 923 .show_starget_port_id = 1,
914 .show_starget_port_name = 1, 924 .show_starget_port_name = 1,
915 .show_starget_node_name = 1, 925 .show_starget_node_name = 1,
926 .show_rport_supported_classes = 1,
927 .show_host_node_name = 1,
928 .show_host_port_name = 1,
929 .show_host_supported_classes = 1,
930 .show_host_serial_number = 1,
916}; 931};
917 932
918/** 933/**