Commit dfbce75a authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Nicholas Bellinger

target_core_alua: store old and pending ALUA state

During state transition we should be storing both the original
and the pending state.
Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 1e0b9403
...@@ -812,12 +812,15 @@ static int core_alua_do_transition_tg_pt( ...@@ -812,12 +812,15 @@ static int core_alua_do_transition_tg_pt(
struct se_lun_acl *lacl; struct se_lun_acl *lacl;
struct se_port *port; struct se_port *port;
struct t10_alua_tg_pt_gp_member *mem; struct t10_alua_tg_pt_gp_member *mem;
int old_state = 0;
/* /*
* Save the old primary ALUA access state, and set the current state * Save the old primary ALUA access state, and set the current state
* to ALUA_ACCESS_STATE_TRANSITION. * to ALUA_ACCESS_STATE_TRANSITION.
*/ */
old_state = atomic_read(&tg_pt_gp->tg_pt_gp_alua_access_state); tg_pt_gp->tg_pt_gp_alua_previous_state =
atomic_read(&tg_pt_gp->tg_pt_gp_alua_access_state);
tg_pt_gp->tg_pt_gp_alua_pending_state = new_state;
atomic_set(&tg_pt_gp->tg_pt_gp_alua_access_state, atomic_set(&tg_pt_gp->tg_pt_gp_alua_access_state,
ALUA_ACCESS_STATE_TRANSITION); ALUA_ACCESS_STATE_TRANSITION);
tg_pt_gp->tg_pt_gp_alua_access_status = (explicit) ? tg_pt_gp->tg_pt_gp_alua_access_status = (explicit) ?
...@@ -898,13 +901,15 @@ static int core_alua_do_transition_tg_pt( ...@@ -898,13 +901,15 @@ static int core_alua_do_transition_tg_pt(
/* /*
* Set the current primary ALUA access state to the requested new state * Set the current primary ALUA access state to the requested new state
*/ */
atomic_set(&tg_pt_gp->tg_pt_gp_alua_access_state, new_state); atomic_set(&tg_pt_gp->tg_pt_gp_alua_access_state,
tg_pt_gp->tg_pt_gp_alua_pending_state);
pr_debug("Successful %s ALUA transition TG PT Group: %s ID: %hu" pr_debug("Successful %s ALUA transition TG PT Group: %s ID: %hu"
" from primary access state %s to %s\n", (explicit) ? "explicit" : " from primary access state %s to %s\n", (explicit) ? "explicit" :
"implicit", config_item_name(&tg_pt_gp->tg_pt_gp_group.cg_item), "implicit", config_item_name(&tg_pt_gp->tg_pt_gp_group.cg_item),
tg_pt_gp->tg_pt_gp_id, core_alua_dump_state(old_state), tg_pt_gp->tg_pt_gp_id,
core_alua_dump_state(new_state)); core_alua_dump_state(tg_pt_gp->tg_pt_gp_alua_previous_state),
core_alua_dump_state(tg_pt_gp->tg_pt_gp_alua_pending_state));
return 0; return 0;
} }
......
...@@ -284,6 +284,8 @@ struct t10_alua_tg_pt_gp { ...@@ -284,6 +284,8 @@ struct t10_alua_tg_pt_gp {
u16 tg_pt_gp_id; u16 tg_pt_gp_id;
int tg_pt_gp_valid_id; int tg_pt_gp_valid_id;
int tg_pt_gp_alua_supported_states; int tg_pt_gp_alua_supported_states;
int tg_pt_gp_alua_pending_state;
int tg_pt_gp_alua_previous_state;
int tg_pt_gp_alua_access_status; int tg_pt_gp_alua_access_status;
int tg_pt_gp_alua_access_type; int tg_pt_gp_alua_access_type;
int tg_pt_gp_nonop_delay_msecs; int tg_pt_gp_nonop_delay_msecs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment