Ack, code review only. /Thanks HansN
-----Original Message----- From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] Sent: den 5 mars 2015 05:07 To: Hans Nordebäck; nagendr...@oracle.com Cc: opensaf-devel@lists.sourceforge.net Subject: [PATCH 1 of 1] amfnd: issue remove cbk for assigning csi after successful assignment V2[#1046] osaf/services/saf/amf/amfnd/comp.cc | 55 ++++++++++++++++++++---- osaf/services/saf/amf/amfnd/include/avnd_comp.h | 5 ++ osaf/services/saf/amf/amfnd/sidb.cc | 1 + 3 files changed, 51 insertions(+), 10 deletions(-) This is version-2 after removing check on SI for REMOVED state. This check is not needed as a SI moves to REMOVED state only after all of its CSIs are removed. A user locks a SI and a component faults with comp_restart recovery during remove callback on standby SU. After this when user tries to unlock SI, unlock operation gets timed out. When AMFND gets removal of assignment on standby SU (having three comps), because of lock operation on SI, it issues removal callback to comp1. While comp1 is handling removal callback another healthy component, which is still assigned for a CSI of this SI, faults with comp_restart recovery. When comp2 gets repaired, AMF reassigns CSIs to it. In the meantime, when comp1 responds for the removal callback AMFND does not issue removal callback to the CSI of comp2 as it is in assigning state. AMFND goes on and finishes removal in comp3. After successful reassignments in comp2, AMFND does not issue removal callback to comp2. Due to this, AMFD did not get response from AMFND for successful removal of SI. Patch fixes the problem by issuing removal callback for a assigning CSI after successful assignment. diff --git a/osaf/services/saf/amf/amfnd/comp.cc b/osaf/services/saf/amf/amfnd/comp.cc --- a/osaf/services/saf/amf/amfnd/comp.cc +++ b/osaf/services/saf/amf/amfnd/comp.cc @@ -1558,6 +1558,17 @@ uint32_t avnd_comp_csi_assign_done(AVND_ rc = avnd_su_si_oper_done(cb, comp->su, m_AVND_SU_IS_ALL_SI(comp->su) ? NULL : csi->si); } } + + /* + If this CSI was in assigning state due to component restart and that time removal + request came from AMFD, AMFND waits for the completion of assignment. + After successful assignment, AMFND will start removal of CSI. + */ + if ((csi->pending_removal == true) && + (csi->si->curr_assign_state == AVND_SU_SI_ASSIGN_STATE_REMOVING)) { + rc = avnd_comp_csi_remove(cb, csi->comp, csi); + csi->pending_removal = false; + } } else { /* assign all the csis belonging to the next rank in one shot */ /* get the first csi-record for this comp */ curr_csi = m_AVND_CSI_REC_FROM_COMP_DLL_NODE_GET(m_NCS_DBLIST_FIND_FIRST(&comp->csi_list)); @@ -1579,6 +1590,19 @@ done: TRACE_LEAVE2("%u", rc); return rc; } + +static bool all_csis_in_si_removed(const AVND_SU_SI_REC *si) { + AVND_COMP_CSI_REC *csi; + for (csi = (AVND_COMP_CSI_REC *)m_NCS_DBLIST_FIND_FIRST(&si->csi_list); + csi; + csi = (AVND_COMP_CSI_REC *)m_NCS_DBLIST_FIND_NEXT(&csi->si_dll_node)) +{ + + if (csi->curr_assign_state != AVND_COMP_CSI_ASSIGN_STATE_REMOVED) + return false; + } + return true; +} /** * @brief Checks if all csis of all the sis in this su are in removed state * @@ -1679,18 +1703,29 @@ uint32_t avnd_comp_csi_remove_done(AVND_ goto done; } else { - curr_csi = (AVND_COMP_CSI_REC *)m_NCS_DBLIST_FIND_PREV(&csi->si_dll_node); - - /* assign the csi */ - if (curr_csi) - rc = avnd_comp_csi_remove(cb, curr_csi->comp, curr_csi); - else - /* all csis belonging to the si are removed */ + for (curr_csi = (AVND_COMP_CSI_REC *)m_NCS_DBLIST_FIND_LAST(&csi->si->csi_list); + curr_csi; + curr_csi = (AVND_COMP_CSI_REC *)m_NCS_DBLIST_FIND_PREV(&curr_csi->si_dll_node)) { + if (m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_REMOVED(curr_csi)) + continue; + else if (m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_REMOVING(curr_csi)) + break; + else if (m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_ASSIGNING(curr_csi)) { + TRACE("'%s' is getting assigned, remove it after assignment", + curr_csi->name.value); + curr_csi->pending_removal = true; + break; + } + else { + rc = avnd_comp_csi_remove(cb, curr_csi->comp, curr_csi); + break; + } + } + + /* all csis belonging to the si are removed */ + if (all_csis_in_si_removed(csi->si) == true) rc = avnd_su_si_oper_done(cb, comp->su, m_AVND_SU_IS_ALL_SI(comp->su) ? NULL : csi->si); - - if (NCSCC_RC_SUCCESS != rc) - goto done; } } else { /* Issue remove callback with TARGET_ALL for CSIs belonging to prv rank.*/ diff --git a/osaf/services/saf/amf/amfnd/include/avnd_comp.h b/osaf/services/saf/amf/amfnd/include/avnd_comp.h --- a/osaf/services/saf/amf/amfnd/include/avnd_comp.h +++ b/osaf/services/saf/amf/amfnd/include/avnd_comp.h @@ -187,6 +187,11 @@ typedef struct avnd_comp_csi_rec { SaNameT su_name; /* For Checkpointing */ AVSV_SUSI_ACT single_csi_add_rem_in_si; /* To detect whether single csi removal is going on.*/ + bool pending_removal; /*Flag is used when AMFND gets removal of assignments from AMFD + when a CSI is still in assigning state. In such case, AMFND can issue + removal callback only after CSI gets assigned. AMFND will mark this flag + so that it can start removal after CSI is assigned. + */ } AVND_COMP_CSI_REC; #define AVND_COMP_CSI_REC_NULL ((AVND_COMP_CSI_REC *)0) diff --git a/osaf/services/saf/amf/amfnd/sidb.cc b/osaf/services/saf/amf/amfnd/sidb.cc --- a/osaf/services/saf/amf/amfnd/sidb.cc +++ b/osaf/services/saf/amf/amfnd/sidb.cc @@ -423,6 +423,7 @@ AVND_COMP_CSI_REC *avnd_su_si_csi_rec_ad csi_rec->comp_name = comp->name; csi_rec->si_name = si_rec->name; csi_rec->su_name = su->name; + csi_rec->pending_removal = false; return csi_rec; ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel