In amfnd, there is a flag represent for the amfd service state (up/down). That flag was set by amfnd main thread and amfnd mds thread. If two amfd NEW_ACTIVE events come at almost the same time, the up flag value will be inccorect due to the setting conflict between two threads. Solution is to set that flag in main thread only and check the amfd NO_ACTIVE event. --- src/amf/amfnd/di.cc | 6 ++++++ src/amf/amfnd/mds.cc | 16 ++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/amf/amfnd/di.cc b/src/amf/amfnd/di.cc index d1d83bab6..01fd1ad14 100644 --- a/src/amf/amfnd/di.cc +++ b/src/amf/amfnd/di.cc @@ -703,6 +703,12 @@ uint32_t avnd_evt_mds_avd_dn_evh(AVND_CB *cb, AVND_EVT *evt) { TRACE_ENTER(); + if (evt->info.mds.i_change == NCSMDS_NO_ACTIVE) { + m_AVND_CB_AVD_UP_RESET(cb); + TRACE_LEAVE(); + return rc; + } + if (m_MDS_DEST_IS_AN_ADEST(evt->info.mds.mds_dest)) { if (evt->info.mds.node_id != ncs_get_node_id()) { /* Ignore the other AVD Adest Down.*/ diff --git a/src/amf/amfnd/mds.cc b/src/amf/amfnd/mds.cc index 43d1dbedc..869c7a02b 100644 --- a/src/amf/amfnd/mds.cc +++ b/src/amf/amfnd/mds.cc @@ -523,13 +523,6 @@ uint32_t avnd_mds_svc_evt(AVND_CB *cb, MDS_CALLBACK_SVC_EVENT_INFO *evt_info) { case NCSMDS_NEW_ACTIVE: if (evt_info->i_svc_id == NCSMDS_SVC_ID_AVD) { LOG_NO("AVD NEW_ACTIVE, adest:%" PRIu64, evt_info->i_dest); - - // sometimes NEW_ACTIVE director is received before - // DOWN is received for the old director .. - if (m_AVND_CB_IS_AVD_UP(cb)) { - m_AVND_CB_AVD_UP_RESET(cb); - } - evt = avnd_evt_create(cb, AVND_EVT_MDS_AVD_UP, 0, &evt_info->i_dest, 0, 0, 0); evt->info.mds.i_change = evt_info->i_change; @@ -584,7 +577,13 @@ uint32_t avnd_mds_svc_evt(AVND_CB *cb, MDS_CALLBACK_SVC_EVENT_INFO *evt_info) { osafassert(0); } break; - + case NCSMDS_NO_ACTIVE: + if (evt_info->i_svc_id == NCSMDS_SVC_ID_AVD) { + evt = avnd_evt_create(cb, AVND_EVT_MDS_AVD_DN, 0, &evt_info->i_dest, + &evt_info->i_node_id, 0, 0); + evt->info.mds.i_change = evt_info->i_change; + } + break; case NCSMDS_DOWN: switch (evt_info->i_svc_id) { case NCSMDS_SVC_ID_AVD: @@ -596,6 +595,7 @@ uint32_t avnd_mds_svc_evt(AVND_CB *cb, MDS_CALLBACK_SVC_EVENT_INFO *evt_info) { evt = avnd_evt_create(cb, AVND_EVT_MDS_AVD_DN, 0, &evt_info->i_dest, &evt_info->i_node_id, 0, 0); + evt->info.mds.i_change = evt_info->i_change; break; case NCSMDS_SVC_ID_AVA: -- 2.25.1 _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel