aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_alua.c
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2013-12-17 03:18:45 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2013-12-17 13:34:49 -0500
commitdfbce75ac8b4ed5dc51f8f144ebb274db940388d (patch)
tree84a804689e3316f2a5df0737d0680cd5bed14325 /drivers/target/target_core_alua.c
parent1e0b9403bd2e77006ae8dcdf279c0f30c7efc258 (diff)
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>
Diffstat (limited to 'drivers/target/target_core_alua.c')
-rw-r--r--drivers/target/target_core_alua.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
index 738244bceb1b..4805e970295a 100644
--- a/drivers/target/target_core_alua.c
+++ b/drivers/target/target_core_alua.c
@@ -812,12 +812,15 @@ static int core_alua_do_transition_tg_pt(
812 struct se_lun_acl *lacl; 812 struct se_lun_acl *lacl;
813 struct se_port *port; 813 struct se_port *port;
814 struct t10_alua_tg_pt_gp_member *mem; 814 struct t10_alua_tg_pt_gp_member *mem;
815 int old_state = 0; 815
816 /* 816 /*
817 * Save the old primary ALUA access state, and set the current state 817 * Save the old primary ALUA access state, and set the current state
818 * to ALUA_ACCESS_STATE_TRANSITION. 818 * to ALUA_ACCESS_STATE_TRANSITION.
819 */ 819 */
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
821 atomic_set(&tg_pt_gp->tg_pt_gp_alua_access_state, 824 atomic_set(&tg_pt_gp->tg_pt_gp_alua_access_state,
822 ALUA_ACCESS_STATE_TRANSITION); 825 ALUA_ACCESS_STATE_TRANSITION);
823 tg_pt_gp->tg_pt_gp_alua_access_status = (explicit) ? 826 tg_pt_gp->tg_pt_gp_alua_access_status = (explicit) ?
@@ -898,13 +901,15 @@ static int core_alua_do_transition_tg_pt(
898 /* 901 /*
899 * Set the current primary ALUA access state to the requested new state 902 * Set the current primary ALUA access state to the requested new state
900 */ 903 */
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);
902 906
903 pr_debug("Successful %s ALUA transition TG PT Group: %s ID: %hu" 907 pr_debug("Successful %s ALUA transition TG PT Group: %s ID: %hu"
904 " from primary access state %s to %s\n", (explicit) ? "explicit" : 908 " from primary access state %s to %s\n", (explicit) ? "explicit" :
905 "implicit", config_item_name(&tg_pt_gp->tg_pt_gp_group.cg_item), 909 "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), 910 tg_pt_gp->tg_pt_gp_id,
907 core_alua_dump_state(new_state)); 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));
908 913
909 return 0; 914 return 0;
910} 915}