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;
                                        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:
 
                                   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;
 
 
        }
 }
 
+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,
        .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,