Skip to content

Commit

Permalink
[SCSI] zfcp: Fix erp escalation procedure
Browse files Browse the repository at this point in the history
If an action fails, retry it until the erp count exceeds the
threshold. If there is something fundamentally wrong, the FSF layer
will trigger a more appropriate action depending on the FSF status
codes.

The followup for successful actions is a different followup than
retrying failed actions, so split the code two functions to make this
clear.

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@HansenPartnership.com>
  • Loading branch information
Christof Schmitt authored and James Bottomley committed Jul 30, 2009
1 parent ddb3e0c commit 85600f7
Showing 1 changed file with 24 additions and 26 deletions.
50 changes: 24 additions & 26 deletions drivers/s390/scsi/zfcp_erp.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,40 +553,35 @@ static void _zfcp_erp_unit_reopen_all(struct zfcp_port *port, int clear,
_zfcp_erp_unit_reopen(unit, clear, id, ref);
}

static void zfcp_erp_strategy_followup_actions(struct zfcp_erp_action *act)
static void zfcp_erp_strategy_followup_failed(struct zfcp_erp_action *act)
{
struct zfcp_adapter *adapter = act->adapter;
struct zfcp_port *port = act->port;
struct zfcp_unit *unit = act->unit;
u32 status = act->status;

/* initiate follow-up actions depending on success of finished action */
switch (act->action) {

case ZFCP_ERP_ACTION_REOPEN_ADAPTER:
if (status == ZFCP_ERP_SUCCEEDED)
_zfcp_erp_port_reopen_all(adapter, 0, "ersfa_1", NULL);
else
_zfcp_erp_adapter_reopen(adapter, 0, "ersfa_2", NULL);
_zfcp_erp_adapter_reopen(act->adapter, 0, "ersff_1", NULL);
break;

case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
if (status == ZFCP_ERP_SUCCEEDED)
_zfcp_erp_port_reopen(port, 0, "ersfa_3", NULL);
else
_zfcp_erp_adapter_reopen(adapter, 0, "ersfa_4", NULL);
_zfcp_erp_port_forced_reopen(act->port, 0, "ersff_2", NULL);
break;

case ZFCP_ERP_ACTION_REOPEN_PORT:
if (status == ZFCP_ERP_SUCCEEDED)
_zfcp_erp_unit_reopen_all(port, 0, "ersfa_5", NULL);
else
_zfcp_erp_port_forced_reopen(port, 0, "ersfa_6", NULL);
_zfcp_erp_port_reopen(act->port, 0, "ersff_3", NULL);
break;

case ZFCP_ERP_ACTION_REOPEN_UNIT:
if (status != ZFCP_ERP_SUCCEEDED)
_zfcp_erp_port_reopen(unit->port, 0, "ersfa_7", NULL);
_zfcp_erp_unit_reopen(act->unit, 0, "ersff_4", NULL);
break;
}
}

static void zfcp_erp_strategy_followup_success(struct zfcp_erp_action *act)
{
switch (act->action) {
case ZFCP_ERP_ACTION_REOPEN_ADAPTER:
_zfcp_erp_port_reopen_all(act->adapter, 0, "ersfs_1", NULL);
break;
case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
_zfcp_erp_port_reopen(act->port, 0, "ersfs_2", NULL);
break;
case ZFCP_ERP_ACTION_REOPEN_PORT:
_zfcp_erp_unit_reopen_all(act->port, 0, "ersfs_3", NULL);
break;
}
}
Expand Down Expand Up @@ -1289,7 +1284,10 @@ static int zfcp_erp_strategy(struct zfcp_erp_action *erp_action)
retval = zfcp_erp_strategy_statechange(erp_action, retval);
if (retval == ZFCP_ERP_EXIT)
goto unlock;
zfcp_erp_strategy_followup_actions(erp_action);
if (retval == ZFCP_ERP_SUCCEEDED)
zfcp_erp_strategy_followup_success(erp_action);
if (retval == ZFCP_ERP_FAILED)
zfcp_erp_strategy_followup_failed(erp_action);

unlock:
write_unlock(&adapter->erp_lock);
Expand Down

0 comments on commit 85600f7

Please sign in to comment.