Thanks Minh for your comments. I have just sent the V2 patch which was updated due to your & Praveen comments.
Regards, Vu > -----Original Message----- > From: minh chau [mailto:minh.c...@dektech.com.au] > Sent: Tuesday, November 22, 2016 5:30 AM > To: Vu Minh Nguyen <vu.m.ngu...@dektech.com.au>; > praveen.malv...@oracle.com > Cc: opensaf-devel@lists.sourceforge.net > Subject: Re: [PATCH 1 of 1] ntf: handle error code TRY_AGAIN of > saClmInitialize() [#2191] > > Hi Vu, > > My comments: > - The max_waiting_time_10s, do we really need a time limitation? The clm > initialization should be completed, now it is threaded, so it can retry > till success > - As same as Lennart's comment on #2192, use base::Sleep, or > osaf_nanosleep > > Thanks, > Minh > On 17/11/16 17:28, Vu Minh Nguyen wrote: > > osaf/services/saf/ntfsv/ntfs/ntfs_clm.c | 14 +++++++++++++- > > 1 files changed, 13 insertions(+), 1 deletions(-) > > > > > > NTF did not deal with TRY_AGAIN error code of `saClmInitialize()`, > > NTF would exit, and cause node reboot if getting TRY_AGAIN. > > > > The patch adds a while loop to do retry when getting TRY_AGAIN. > > > > diff --git a/osaf/services/saf/ntfsv/ntfs/ntfs_clm.c > b/osaf/services/saf/ntfsv/ntfs/ntfs_clm.c > > --- a/osaf/services/saf/ntfsv/ntfs/ntfs_clm.c > > +++ b/osaf/services/saf/ntfsv/ntfs/ntfs_clm.c > > @@ -101,13 +101,25 @@ void *ntfs_clm_init_thread(void *cb) > > { > > ntfs_cb_t *_ntfs_cb = (ntfs_cb_t *) cb; > > SaAisErrorT rc = SA_AIS_OK; > > + uint32_t msecs_waited = 0; > > + const uint32_t max_waiting_time_10s = 10 * 1000; /* 10 secs */ > > + > > TRACE_ENTER(); > > + > > rc = saClmInitialize_4(&_ntfs_cb->clm_hdl, &clm_callbacks, > &clmVersion); > > + while (((rc == SA_AIS_ERR_TRY_AGAIN) || (rc == > SA_AIS_ERR_TIMEOUT) || > > + (rc == SA_AIS_ERR_UNAVAILABLE)) && > > + (msecs_waited < max_waiting_time_10s)) { > > + usleep(100*1000); > > + msecs_waited += 100; > > + rc = saClmInitialize_4(&_ntfs_cb->clm_hdl, &clm_callbacks, > &clmVersion); > > + } > > if (rc != SA_AIS_OK) { > > LOG_ER("saClmInitialize failed with error: %d", rc); > > TRACE_LEAVE(); > > - exit(EXIT_FAILURE); > > + exit(EXIT_FAILURE); > > } > > + > > rc = saClmSelectionObjectGet(_ntfs_cb->clm_hdl, &ntfs_cb- > >clmSelectionObject); > > if (rc != SA_AIS_OK) { > > LOG_ER("saClmSelectionObjectGet failed with error: %d", > rc); > > ------------------------------------------------------------------------------ _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel