+/*
+ * function: zfcp_erp_port_access_denied
+ *
+ * purpose:
+ */
+void
+zfcp_erp_port_access_denied(struct zfcp_port *port)
+{
+ struct zfcp_adapter *adapter = port->adapter;
+ unsigned long flags;
+
+ debug_text_event(adapter->erp_dbf, 3, "p_access_block");
+ debug_event(adapter->erp_dbf, 3, &port->wwpn, sizeof(wwn_t));
+ read_lock_irqsave(&zfcp_data.config_lock, flags);
+ zfcp_erp_modify_port_status(port, ZFCP_STATUS_COMMON_ERP_FAILED |
+ ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET);
+ read_unlock_irqrestore(&zfcp_data.config_lock, flags);
+}
+
+/*
+ * function: zfcp_erp_unit_access_denied
+ *
+ * purpose:
+ */
+void
+zfcp_erp_unit_access_denied(struct zfcp_unit *unit)
+{
+ struct zfcp_adapter *adapter = unit->port->adapter;
+
+ debug_text_event(adapter->erp_dbf, 3, "u_access_block");
+ debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof(fcp_lun_t));
+ zfcp_erp_modify_unit_status(unit, ZFCP_STATUS_COMMON_ERP_FAILED |
+ ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET);
+}
+
+/*
+ * function: zfcp_erp_adapter_access_changed
+ *
+ * purpose:
+ */
+void
+zfcp_erp_adapter_access_changed(struct zfcp_adapter *adapter)
+{
+ struct zfcp_port *port;
+ unsigned long flags;
+
+ debug_text_event(adapter->erp_dbf, 3, "a_access_unblock");
+ debug_event(adapter->erp_dbf, 3, &adapter->name, 8);
+
+ zfcp_erp_port_access_changed(adapter->nameserver_port);
+ read_lock_irqsave(&zfcp_data.config_lock, flags);
+ list_for_each_entry(port, &adapter->port_list_head, list)
+ if (port != adapter->nameserver_port)
+ zfcp_erp_port_access_changed(port);
+ read_unlock_irqrestore(&zfcp_data.config_lock, flags);
+}
+
+/*
+ * function: zfcp_erp_port_access_changed
+ *
+ * purpose:
+ */
+void
+zfcp_erp_port_access_changed(struct zfcp_port *port)
+{
+ struct zfcp_adapter *adapter = port->adapter;
+ struct zfcp_unit *unit;
+
+ debug_text_event(adapter->erp_dbf, 3, "p_access_unblock");
+ debug_event(adapter->erp_dbf, 3, &port->wwpn, sizeof(wwn_t));
+
+ if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED,
+ &port->status)) {
+ if (!atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status))
+ list_for_each_entry(unit, &port->unit_list_head, list)
+ zfcp_erp_unit_access_changed(unit);
+ return;
+ }
+
+ ZFCP_LOG_NORMAL("reopen of port 0x%016Lx on adapter %s "
+ "(due to ACT update)\n",
+ port->wwpn, zfcp_get_busid_by_adapter(adapter));
+ if (zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED) != 0)
+ ZFCP_LOG_NORMAL("failed reopen of port"
+ "(adapter %s, wwpn=0x%016Lx)\n",
+ zfcp_get_busid_by_adapter(adapter), port->wwpn);
+}
+
+/*
+ * function: zfcp_erp_unit_access_changed
+ *
+ * purpose:
+ */
+void
+zfcp_erp_unit_access_changed(struct zfcp_unit *unit)
+{
+ struct zfcp_adapter *adapter = unit->port->adapter;
+
+ debug_text_event(adapter->erp_dbf, 3, "u_access_unblock");
+ debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof(fcp_lun_t));
+
+ if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED, &unit->status))
+ return;
+
+ ZFCP_LOG_NORMAL("reopen of unit 0x%016Lx on port 0x%016Lx "
+ " on adapter %s (due to ACT update)\n",
+ unit->fcp_lun, unit->port->wwpn,
+ zfcp_get_busid_by_adapter(adapter));
+ if (zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED) != 0)
+ ZFCP_LOG_NORMAL("failed reopen of unit (adapter %s, "
+ "wwpn=0x%016Lx, fcp_lun=0x%016Lx)\n",
+ zfcp_get_busid_by_adapter(adapter),
+ unit->port->wwpn, unit->fcp_lun);
+}
+