From 792a896abb9231c5d8b7e4286ec8dd64bf185acb Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Sat, 15 Jul 2017 03:26:11 +0000 Subject: [PATCH] With the new 'active' attribute, a bug exists where the attribute value is not changed when the appropriate ALUA state is set, unless a target session exists for the target group target; this patch fixes that bug, see here for more information: https://sourceforge.net/p/scst/mailman/message/35898014/ Signed-off-by: Marc A. Smith git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7211 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_tg.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scst/src/scst_tg.c b/scst/src/scst_tg.c index 869f3c3e2..2ca355482 100644 --- a/scst/src/scst_tg.c +++ b/scst/src/scst_tg.c @@ -975,6 +975,10 @@ static void __scst_tg_set_state(struct scst_target_group *tg, list_for_each_entry(dg_dev, &tg->dg->dev_list, entry) { dev = dg_dev->dev; dev_changed = false; + if ((dev->handler->on_alua_state_change_start != NULL) && !dev_changed) { + dev->handler->on_alua_state_change_start(dev, old_state, state); + dev_changed = true; + } list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { tgt = tgt_dev->sess->tgt; @@ -982,11 +986,6 @@ static void __scst_tg_set_state(struct scst_target_group *tg, if (tg_tgt->tgt == tgt) { bool gen_ua = (state != SCST_TG_STATE_TRANSITIONING); - if ((dev->handler->on_alua_state_change_start != NULL) && !dev_changed) { - dev->handler->on_alua_state_change_start(dev, old_state, state); - dev_changed = true; - } - if ((tg->dg->stpg_rel_tgt_id == tgt_dev->sess->tgt->rel_tgt_id) && tid_equal(tg->dg->stpg_transport_id, tgt_dev->sess->transport_id)) gen_ua = false;