Considering #739 can you explain why you changed the while loop into a for loop?
After the call to avnd_comp_csi_remove_done() the memory that the csi variable points to might have been freed thus can't be trusted for the next iteration of the loop. Otherwise the patch looks OK but I haven't tested it yet. Thanks, Hans On 6 February 2014 12:42, Nagendra Kumar <[email protected]> wrote: > Ack > > Thanks > -Nagu > >> -----Original Message----- >> From: Praveen Malviya >> Sent: 04 February 2014 15:14 >> To: [email protected]; Nagendra Kumar; [email protected] >> Cc: [email protected] >> Subject: [PATCH 1 of 1] amfnd : handle successful cleanup of assigned comp >> gracefully in shutdown phase [#767] >> >> osaf/services/saf/amf/amfnd/clc.cc | 26 ++++++++++++++++++++------ >> 1 files changed, 20 insertions(+), 6 deletions(-) >> >> >> During opensaf shutdown AMFND removes the SIs from the SUs in the reverse >> order of their ranks. At component level this gets >> translated as giving >> csi removal callback to the components with TARGET_ONE. >> Reported problem occurs when an assigned component faults while removal is >> going on other components. >> When AMFND gets cleanup success event, it sees it as if the component was >> faulted while handling removal >> callback and thus it tries to move CSIs and SIs assigned to this component to >> removed state. Since CSIs and SIs were already in assigned state AMFND >> asserts for assigning state check. >> This patch ensures that during shutdown phase if an assigned component faults >> then AMFND should mark CSIs and SIs assigned if they were in assigning state. >> >> diff --git a/osaf/services/saf/amf/amfnd/clc.cc >> b/osaf/services/saf/amf/amfnd/clc.cc >> --- a/osaf/services/saf/amf/amfnd/clc.cc >> +++ b/osaf/services/saf/amf/amfnd/clc.cc >> @@ -2038,12 +2038,26 @@ uint32_t avnd_comp_clc_terming_cleansucc >> */ >> if (!comp->su->is_ncs && comp->csi_list.n_nodes > 0) { >> AVND_COMP_CSI_REC *csi; >> - int csis_removed = 0; // for sanity checking number of >> loops >> - >> - while ((csi = >> m_AVND_CSI_REC_FROM_COMP_DLL_NODE_GET(m_NCS_DBLIST_FIND_FIRS >> T(&comp->csi_list))) != NULL) { >> - >> m_AVND_COMP_CSI_CURR_ASSIGN_STATE_SET(csi, >> AVND_COMP_CSI_ASSIGN_STATE_REMOVED); >> - rc = avnd_comp_csi_remove_done(cb, comp, >> csi); >> - osafassert(++csis_removed < 1000); >> + >> + for (csi = >> m_AVND_CSI_REC_FROM_COMP_DLL_NODE_GET(m_NCS_DBLIST_FIND_FIRS >> T(&comp->csi_list)); >> + csi; >> + csi = >> m_AVND_CSI_REC_FROM_COMP_DLL_NODE_GET(m_NCS_DBLIST_FIND_NEX >> T(&csi->comp_dll_node))) { >> + /* In shutdown phase SIs are removed >> honoring saAmfSIRank in reverse >> + order. A component which is having a CSI >> from a higher rank assigned >> + SI can fault while removal of lower rank >> SIs is >> going on. In such >> + case CSIs of this component will be in >> assigned state only, so remove >> + done indication cannot be generated for >> assigned CSIs. >> + */ >> + if >> (m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_REMOVING(csi)) >> + rc = >> avnd_comp_csi_remove_done(cb, comp, csi); >> + >> + /* Removal of last CSI from this component >> may lead to SUSI assign/remove >> + done indication, which eventually deletes >> all >> COMP-CSI record. >> + In such a case there will not be any CSI in >> comp->csi_list, so come >> + out of the loop. >> + */ >> + if (!comp->csi_list.n_nodes) >> + break; >> } >> } >> > > ------------------------------------------------------------------------------ > Managing the Performance of Cloud-Based Applications > Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. > Read the Whitepaper. > http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk > _______________________________________________ > Opensaf-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/opensaf-devel ------------------------------------------------------------------------------ Android apps run on BlackBerry 10 Introducing the new BlackBerry 10.2.1 Runtime for Android apps. Now with support for Jelly Bean, Bluetooth, Mapview and more. Get your Android app in front of a whole new audience. Start now. http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk _______________________________________________ Opensaf-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
