Re: [devel] [PATCH 1/1] imm: fix immnd coredump due to initialized CLM handle [#2549]
Hi Mahesh, immnd_cb->clm_hdl should be cleared when CLM invalidates the handle. CLM handle should not be closed when the node goes headless. immnd_cb->clm_hdl is set to 0 in main() function when CLM handle is invalidated and selected object closed. That's the last line in the patch where immnd_cb->clm_hdl is set to 0. Thanks, Zoran -Original Message- From: A V Mahesh [mailto:mahesh.va...@oracle.com] Sent: den 16 augusti 2017 05:59 To: Zoran MilinkovicCc: opensaf-devel@lists.sourceforge.net Subject: Re: [PATCH 1/1] imm: fix immnd coredump due to initialized CLM handle [#2549] Hi Zoran , ACK , with following , not tested. Please check that the `immnd_cb->clm_hdl` cleared on Headless case. -AVM On 8/9/2017 5:14 PM, Zoran Milinkovic wrote: > Initially CLM handle is set to 0. When CLM handle is initialized, it > can be initialized again only when saClmDispatch returns > SA_AIS_ERR_BAD_HANDLE. > This will prevent coredumps with initialized CLM handle caused with > MDS UP message for AMF and CLM services. > --- > src/imm/immnd/immnd_clm.c | 7 +++ > src/imm/immnd/immnd_main.c | 8 +--- > 2 files changed, 12 insertions(+), 3 deletions(-) > > diff --git a/src/imm/immnd/immnd_clm.c b/src/imm/immnd/immnd_clm.c > index 4019439..beae739 100644 > --- a/src/imm/immnd/immnd_clm.c > +++ b/src/imm/immnd/immnd_clm.c > @@ -199,6 +199,11 @@ void *immnd_clm_init_thread(void *cb) > { > TRACE_ENTER(); > > + if(immnd_cb->clm_hdl) { > + TRACE("CLM handle has already been initialized."); > + goto done; > + } > + > SaAisErrorT rc = > saClmInitialize_4(_cb->clm_hdl, _callbacks, ); > while ((rc == SA_AIS_ERR_TRY_AGAIN) || (rc == SA_AIS_ERR_TIMEOUT) > || @@ -228,6 +233,8 @@ void *immnd_clm_init_thread(void *cb) > exit(EXIT_FAILURE); > } > TRACE("CLM Initialization SUCCESS.."); > + > +done: > TRACE_LEAVE(); > return NULL; > } > diff --git a/src/imm/immnd/immnd_main.c b/src/imm/immnd/immnd_main.c > index bca8f80..0f8364d 100644 > --- a/src/imm/immnd/immnd_main.c > +++ b/src/imm/immnd/immnd_main.c > @@ -423,11 +423,12 @@ int main(int argc, char *argv[]) > } > > if (fds[FD_CLM_INIT].revents & POLLIN) { > - osafassert(!immnd_cb->clm_hdl); > - TRACE("Initalize CLM "); > ncs_sel_obj_rmv_ind(_cb->clm_init_sel_obj, > true, true); > - immnd_init_with_clm(); > + if(!immnd_cb->clm_hdl) { > + TRACE("Initalize CLM "); > + immnd_init_with_clm(); > + } > nfds = 5; > } > > @@ -445,6 +446,7 @@ int main(int argc, char *argv[]) > immnd_cb->clm_hdl); > immnd_clm_node_cleanup( > immnd_cb); > + immnd_cb->clm_hdl = 0; > immnd_cb->clmSelectionObject = > -1; > immnd_init_with_clm(); -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1/1] imm: fix immnd coredump due to initialized CLM handle [#2549]
Hi Zoran , ACK , with following , not tested. Please check that the `immnd_cb->clm_hdl` cleared on Headless case. -AVM On 8/9/2017 5:14 PM, Zoran Milinkovic wrote: Initially CLM handle is set to 0. When CLM handle is initialized, it can be initialized again only when saClmDispatch returns SA_AIS_ERR_BAD_HANDLE. This will prevent coredumps with initialized CLM handle caused with MDS UP message for AMF and CLM services. --- src/imm/immnd/immnd_clm.c | 7 +++ src/imm/immnd/immnd_main.c | 8 +--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/imm/immnd/immnd_clm.c b/src/imm/immnd/immnd_clm.c index 4019439..beae739 100644 --- a/src/imm/immnd/immnd_clm.c +++ b/src/imm/immnd/immnd_clm.c @@ -199,6 +199,11 @@ void *immnd_clm_init_thread(void *cb) { TRACE_ENTER(); + if(immnd_cb->clm_hdl) { + TRACE("CLM handle has already been initialized."); + goto done; + } + SaAisErrorT rc = saClmInitialize_4(_cb->clm_hdl, _callbacks, ); while ((rc == SA_AIS_ERR_TRY_AGAIN) || (rc == SA_AIS_ERR_TIMEOUT) || @@ -228,6 +233,8 @@ void *immnd_clm_init_thread(void *cb) exit(EXIT_FAILURE); } TRACE("CLM Initialization SUCCESS.."); + +done: TRACE_LEAVE(); return NULL; } diff --git a/src/imm/immnd/immnd_main.c b/src/imm/immnd/immnd_main.c index bca8f80..0f8364d 100644 --- a/src/imm/immnd/immnd_main.c +++ b/src/imm/immnd/immnd_main.c @@ -423,11 +423,12 @@ int main(int argc, char *argv[]) } if (fds[FD_CLM_INIT].revents & POLLIN) { - osafassert(!immnd_cb->clm_hdl); - TRACE("Initalize CLM "); ncs_sel_obj_rmv_ind(_cb->clm_init_sel_obj, true, true); - immnd_init_with_clm(); + if(!immnd_cb->clm_hdl) { + TRACE("Initalize CLM "); + immnd_init_with_clm(); + } nfds = 5; } @@ -445,6 +446,7 @@ int main(int argc, char *argv[]) immnd_cb->clm_hdl); immnd_clm_node_cleanup( immnd_cb); + immnd_cb->clm_hdl = 0; immnd_cb->clmSelectionObject = -1; immnd_init_with_clm(); -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1/1] imm: fix immnd coredump due to initialized CLM handle [#2549]
Initially CLM handle is set to 0. When CLM handle is initialized, it can be initialized again only when saClmDispatch returns SA_AIS_ERR_BAD_HANDLE. This will prevent coredumps with initialized CLM handle caused with MDS UP message for AMF and CLM services. --- src/imm/immnd/immnd_clm.c | 7 +++ src/imm/immnd/immnd_main.c | 8 +--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/imm/immnd/immnd_clm.c b/src/imm/immnd/immnd_clm.c index 4019439..beae739 100644 --- a/src/imm/immnd/immnd_clm.c +++ b/src/imm/immnd/immnd_clm.c @@ -199,6 +199,11 @@ void *immnd_clm_init_thread(void *cb) { TRACE_ENTER(); + if(immnd_cb->clm_hdl) { + TRACE("CLM handle has already been initialized."); + goto done; + } + SaAisErrorT rc = saClmInitialize_4(_cb->clm_hdl, _callbacks, ); while ((rc == SA_AIS_ERR_TRY_AGAIN) || (rc == SA_AIS_ERR_TIMEOUT) || @@ -228,6 +233,8 @@ void *immnd_clm_init_thread(void *cb) exit(EXIT_FAILURE); } TRACE("CLM Initialization SUCCESS.."); + +done: TRACE_LEAVE(); return NULL; } diff --git a/src/imm/immnd/immnd_main.c b/src/imm/immnd/immnd_main.c index bca8f80..0f8364d 100644 --- a/src/imm/immnd/immnd_main.c +++ b/src/imm/immnd/immnd_main.c @@ -423,11 +423,12 @@ int main(int argc, char *argv[]) } if (fds[FD_CLM_INIT].revents & POLLIN) { - osafassert(!immnd_cb->clm_hdl); - TRACE("Initalize CLM "); ncs_sel_obj_rmv_ind(_cb->clm_init_sel_obj, true, true); - immnd_init_with_clm(); + if(!immnd_cb->clm_hdl) { + TRACE("Initalize CLM "); + immnd_init_with_clm(); + } nfds = 5; } @@ -445,6 +446,7 @@ int main(int argc, char *argv[]) immnd_cb->clm_hdl); immnd_clm_node_cleanup( immnd_cb); + immnd_cb->clm_hdl = 0; immnd_cb->clmSelectionObject = -1; immnd_init_with_clm(); -- 1.9.1 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel