Skip to content

Commit dfbce75

Browse files
hreineckeNicholas Bellinger
authored andcommitted
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: Hannes Reinecke <hare@suse.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
1 parent 1e0b940 commit dfbce75

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

‎drivers/target/target_core_alua.c‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -812,12 +812,15 @@ static int core_alua_do_transition_tg_pt(
812812
struct se_lun_acl *lacl;
813813
struct se_port *port;
814814
struct t10_alua_tg_pt_gp_member *mem;
815-
int old_state = 0;
815+
816816
/*
817817
* Save the old primary ALUA access state, and set the current state
818818
* to ALUA_ACCESS_STATE_TRANSITION.
819819
*/
820-
old_state = atomic_read(&tg_pt_gp->tg_pt_gp_alua_access_state);
820+
tg_pt_gp->tg_pt_gp_alua_previous_state =
821+
atomic_read(&tg_pt_gp->tg_pt_gp_alua_access_state);
822+
tg_pt_gp->tg_pt_gp_alua_pending_state = new_state;
823+
821824
atomic_set(&tg_pt_gp->tg_pt_gp_alua_access_state,
822825
ALUA_ACCESS_STATE_TRANSITION);
823826
tg_pt_gp->tg_pt_gp_alua_access_status = (explicit) ?
@@ -898,13 +901,15 @@ static int core_alua_do_transition_tg_pt(
898901
/*
899902
* Set the current primary ALUA access state to the requested new state
900903
*/
901-
atomic_set(&tg_pt_gp->tg_pt_gp_alua_access_state, new_state);
904+
atomic_set(&tg_pt_gp->tg_pt_gp_alua_access_state,
905+
tg_pt_gp->tg_pt_gp_alua_pending_state);
902906

903907
pr_debug("Successful %s ALUA transition TG PT Group: %s ID: %hu"
904908
" from primary access state %s to %s\n", (explicit) ? "explicit" :
905909
"implicit", config_item_name(&tg_pt_gp->tg_pt_gp_group.cg_item),
906-
tg_pt_gp->tg_pt_gp_id, core_alua_dump_state(old_state),
907-
core_alua_dump_state(new_state));
910+
tg_pt_gp->tg_pt_gp_id,
911+
core_alua_dump_state(tg_pt_gp->tg_pt_gp_alua_previous_state),
912+
core_alua_dump_state(tg_pt_gp->tg_pt_gp_alua_pending_state));
908913

909914
return 0;
910915
}

‎include/target/target_core_base.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ struct t10_alua_tg_pt_gp {
284284
u16 tg_pt_gp_id;
285285
int tg_pt_gp_valid_id;
286286
int tg_pt_gp_alua_supported_states;
287+
int tg_pt_gp_alua_pending_state;
288+
int tg_pt_gp_alua_previous_state;
287289
int tg_pt_gp_alua_access_status;
288290
int tg_pt_gp_alua_access_type;
289291
int tg_pt_gp_nonop_delay_msecs;

0 commit comments

Comments
 (0)