]> err.no Git - linux-2.6/commitdiff
[SCSI] zfcp: make use of fc_remote_port_delete when target port is unavailable
authorAndreas Herrmann <aherrman@de.ibm.com>
Mon, 22 May 2006 16:25:56 +0000 (18:25 +0200)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>
Sun, 28 May 2006 16:50:17 +0000 (12:50 -0400)
If zfcp's port erp fails we now call fc_remote_port_delete. This helps
to avoid offlined scsi devices if scsi commands time out due to path
failures. When an adapter erp fails we call fc_remote_port_delete for
all ports on that adapter.

Signed-off-by: Andreas Herrmann <aherrman@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/s390/scsi/zfcp_erp.c
drivers/s390/scsi/zfcp_ext.h
drivers/s390/scsi/zfcp_scsi.c

index 05c47f6ca924c9804194f4bf86027fcfcd80fe36..4682c8b8bd2435222dc94d3eda92a5e2cd9411c0 100644 (file)
@@ -3241,9 +3241,13 @@ zfcp_erp_action_cleanup(int action, struct zfcp_adapter *adapter,
                break;
        case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
        case ZFCP_ERP_ACTION_REOPEN_PORT:
+               if (atomic_test_mask(ZFCP_STATUS_PORT_NO_WWPN,
+                                    &port->status)) {
+                       zfcp_port_put(port);
+                       break;
+               }
+
                if ((result == ZFCP_ERP_SUCCEEDED)
-                   && !atomic_test_mask(ZFCP_STATUS_PORT_NO_WWPN,
-                                        &port->status)
                    && !port->rport) {
                        struct fc_rport_identifiers ids;
                        ids.node_name = port->wwnn;
@@ -3264,9 +3268,23 @@ zfcp_erp_action_cleanup(int action, struct zfcp_adapter *adapter,
                                        port->supported_classes;
                        }
                }
+               if ((result != ZFCP_ERP_SUCCEEDED) && port->rport) {
+                       fc_remote_port_delete(port->rport);
+                       port->rport = NULL;
+               }
                zfcp_port_put(port);
                break;
        case ZFCP_ERP_ACTION_REOPEN_ADAPTER:
+               if (result != ZFCP_ERP_SUCCEEDED) {
+                       struct zfcp_port *port;
+                       list_for_each_entry(port, &adapter->port_list_head, list)
+                               if (port->rport &&
+                                   !atomic_test_mask(ZFCP_STATUS_PORT_WKA,
+                                                     &port->status)) {
+                                       fc_remote_port_delete(port->rport);
+                                       port->rport = NULL;
+                               }
+               }
                zfcp_adapter_put(adapter);
                break;
        default:
index ab38b8ce27aad76c498ef5896374ff1f935e12ab..d02366004cdd27412a59bc6c92e3a70153ce1cc0 100644 (file)
@@ -132,8 +132,6 @@ extern int zfcp_scsi_command_async(struct zfcp_adapter *,struct zfcp_unit *,
                                   struct scsi_cmnd *, struct timer_list *);
 extern int zfcp_scsi_command_sync(struct zfcp_unit *, struct scsi_cmnd *,
                                  struct timer_list *);
-extern void zfcp_set_fc_host_attrs(struct zfcp_adapter *);
-extern void zfcp_set_fc_rport_attrs(struct zfcp_port *);
 extern struct scsi_transport_template *zfcp_transport_template;
 extern struct fc_function_template zfcp_transport_functions;
 
index 30e87197f5f887137cbc2a3eaf7cdcfc107a66de..46e14f22ec18fd004b2af2aece837cdba54e73e8 100644 (file)
@@ -800,12 +800,18 @@ zfcp_reset_fc_host_stats(struct Scsi_Host *shost)
        }
 }
 
+static void zfcp_set_rport_dev_loss_tmo(struct fc_rport *rport, u32 timeout)
+{
+       rport->dev_loss_tmo = timeout;
+}
+
 struct fc_function_template zfcp_transport_functions = {
        .show_starget_port_id = 1,
        .show_starget_port_name = 1,
        .show_starget_node_name = 1,
        .show_rport_supported_classes = 1,
        .show_rport_maxframe_size = 1,
+       .show_rport_dev_loss_tmo = 1,
        .show_host_node_name = 1,
        .show_host_port_name = 1,
        .show_host_permanent_port_name = 1,
@@ -815,6 +821,7 @@ struct fc_function_template zfcp_transport_functions = {
        .show_host_serial_number = 1,
        .get_fc_host_stats = zfcp_get_fc_host_stats,
        .reset_fc_host_stats = zfcp_reset_fc_host_stats,
+       .set_rport_dev_loss_tmo = zfcp_set_rport_dev_loss_tmo,
        /* no functions registered for following dynamic attributes but
           directly set by LLDD */
        .show_host_port_type = 1,