Hi Mahesh, Please see my comments below.
Best regards, Nhat Pham -----Original Message----- From: A V Mahesh [mailto:mahesh.va...@oracle.com] Sent: Wednesday, May 11, 2016 2:10 PM To: Nhat Pham <nhat.p...@dektech.com.au>; anders.wid...@ericsson.com Cc: opensaf-devel@lists.sourceforge.net Subject: Re: [PATCH 1 of 1] cpnd: To improve handling fault code returned by saClmInitialize [#1821] Hi Nhat Pham, - We should do saClmInitialize() , in separate thread , please see the example code did for IMM SA_AIS_ERR_BAD_HANDLE on saImmOiDispatch() in amfd code , otherwise other FD event may get time out . [Nhat Pham] Ok, I'll update the patch to run saClmInitialize() in background thread. - One more point , it seems we should handel SA_AIS_ERR_BAD_HANDLE on saClmDispatch() in AMD as well. [Nhat Pham] I'm not clear what you mean about " saClmDispatch() in AMD". Which source file is it? ============================================================================ ====== error = saImmOiDispatch(cb->immOiHandle, SA_DISPATCH_ALL); /* ** BAD_HANDLE is interpreted as an IMM service restart. Try ** reinitialize the IMM OI API in a background thread and let ** this thread do business as usual especially handling write ** requests. ** ** All other errors are treated as non-recoverable (fatal) and will ** cause an exit of the process. */ if (error == SA_AIS_ERR_BAD_HANDLE) { TRACE("main: saImmOiDispatch returned BAD_HANDLE"); /* Initiate IMM reinitializtion in the background */ avd_imm_reinit_bg(); } else if (error != SA_AIS_OK) { LOG_ER("main: saImmOiDispatch FAILED %u", error); break; } ============================================================================ ====== -AVM On 5/11/2016 11:32 AM, Nhat Pham wrote: > osaf/services/saf/cpsv/cpnd/cpnd_init.c | 27 +++++++++++++++++++++------ > 1 files changed, 21 insertions(+), 6 deletions(-) > > > diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_init.c b/osaf/services/saf/cpsv/cpnd/cpnd_init.c > --- a/osaf/services/saf/cpsv/cpnd/cpnd_init.c > +++ b/osaf/services/saf/cpsv/cpnd/cpnd_init.c > @@ -30,6 +30,7 @@ > #include <daemon.h> > #include "cpnd.h" > #include "osaf_poll.h" > +#include "osaf_time.h" > > enum { > FD_TERM, > @@ -240,8 +241,12 @@ static uint32_t cpnd_lib_init(CPND_CREAT > gen_cbk.saClmClusterNodeGetCallback = NULL; > gen_cbk.saClmClusterTrackCallback = cpnd_clm_cluster_track_cb; > rc = saClmInitialize(&clmHandle, &gen_cbk, &clm_version); > - while (rc == SA_AIS_ERR_TRY_AGAIN) { > - usleep(1000000); > + while (rc == SA_AIS_ERR_TRY_AGAIN || rc == SA_AIS_ERR_TIMEOUT || > + rc == SA_AIS_ERR_NO_RESOURCES || rc == SA_AIS_ERR_UNAVAILABLE) { > + if (rc != SA_AIS_ERR_TRY_AGAIN) { > + LOG_WA("cpnd_lib_init: saClmInitialize returned %u", rc); > + } > + osaf_nanosleep(&kHundredMilliseconds); > rc = saClmInitialize(&clmHandle, &gen_cbk, &clm_version); > } > > @@ -586,17 +591,27 @@ void cpnd_main_process(CPND_CB *cb) > SaClmCallbacksT gen_cbk; > > LOG_NO("Bad CLM handle. Reinitializing."); > - usleep(100000); > + osaf_nanosleep(&kHundredMilliseconds); > > m_CPSV_GET_AMF_VER(clm_version); > gen_cbk.saClmClusterNodeGetCallback = NULL; > gen_cbk.saClmClusterTrackCallback = cpnd_clm_cluster_track_cb; > > clm_error = saClmInitialize(&clmHandle, &gen_cbk, &clm_version); > + > + while (clm_error == SA_AIS_ERR_TRY_AGAIN || clm_error == SA_AIS_ERR_TIMEOUT || > + clm_error == SA_AIS_ERR_NO_RESOURCES || clm_error == SA_AIS_ERR_UNAVAILABLE) { > + if (clm_error != SA_AIS_ERR_TRY_AGAIN) { > + LOG_WA("cpnd clm init failed with return value:%d", clm_error); > + } > + osaf_nanosleep(&kHundredMilliseconds); > + clm_error = saClmInitialize(&clmHandle, &gen_cbk, &clm_version); > + } > + > if (clm_error != SA_AIS_OK) { > - LOG_ER("cpnd clm init failed with return value:%d", clm_error); > - TRACE_LEAVE(); > - return; > + LOG_ER("cpnd clm init failed with return value:%d", clm_error); > + TRACE_LEAVE(); > + return; > } > cb->clm_hdl = clmHandle; > } else if (clm_error != SA_AIS_OK) { ------------------------------------------------------------------------------ Mobile security can be enabling, not merely restricting. Employees who bring their own devices (BYOD) to work are irked by the imposition of MDM restrictions. Mobile Device Manager Plus allows you to control only the apps on BYO-devices by containerizing them, leaving personal data untouched! https://ad.doubleclick.net/ddm/clk/304595813;131938128;j _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel