Re: [devel] [PATCH 1 of 2] dtm: check both duplicate node_id & node_ip [#236]
Ack. with the following comments. 1. Correct the TRACE messages (droping--> dropping; right mapping to cluster-id, node-id etc.) 2. With the below changed condition, the flow never hits the existing code flow that deletes the stale-entries (if any). Please check. + if ((new_node->node_id == 0) || (new_node->node_id == node.node_id) || + (strncmp(node.node_ip, new_node->node_ip, INET6_ADDRSTRLEN) == 0)) { + if (new_node->comm_status == true) { Regards, Ramesh. On 6/4/2013 12:52 PM, mahesh.va...@oracle.com wrote: > osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c | 37 > +-- > 1 files changed, 21 insertions(+), 16 deletions(-) > > > diff --git a/osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c > b/osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c > --- a/osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c > +++ b/osaf/services/infrastructure/dtms/dtm/dtm_node_sockets.c > @@ -1158,24 +1158,29 @@ int dtm_process_connect(DTM_INTERNODE_CB > } > > new_node = dtm_node_get_by_id(node.node_id); > - /*new_node = dtm_node_get_by_node_ip((uint8_t *)node.node_ip);*/ > + if (new_node != NULL) { > + if ((new_node->node_id == 0) || (new_node->node_id == > node.node_id) || > + (strncmp(node.node_ip, new_node->node_ip, > INET6_ADDRSTRLEN) == 0)) { > + if (new_node->comm_status == true) { > + if ((new_node->node_id == node.node_id) && > + (strncmp(node.node_ip, > new_node->node_ip, INET6_ADDRSTRLEN) == 0)) > + TRACE("DTM:node already discovered > droping message node_id :%u, cluster_id: %d, node_ip:%s", > + node.cluster_id, > node.node_id, node.node_ip); > + else > + LOG_WA("DTM:node duplicate discovered > droping message node_id :%u, cluster_id: %d, node_ip:%s", > + node.cluster_id, > node.node_id, node.node_ip); > + TRACE_LEAVE2("sock_desc :%d", sock_desc); > + } else { > > - if (new_node != NULL) { > - if (((new_node->node_id == 0) || (new_node->node_id == > node.node_id)) && > - (strncmp(node.node_ip, new_node->node_ip, INET6_ADDRSTRLEN) > == 0) && > - (new_node->comm_status == false)) { > - TRACE("DTM:new_node discovery in progress droping > message"); > - TRACE_LEAVE2("sock_desc :%d", sock_desc); > + TRACE("DTM: discovery in progress droping > message node_id :%u, cluster_id: %d node_ip:%s", > + node.cluster_id, node.node_id, > node.node_ip); > + TRACE_LEAVE2("sock_desc :%d", sock_desc); > + } > return sock_desc; > - } else if ((new_node->comm_status == true) && > (new_node->node_id == node.node_id) && > -(strncmp(node.node_ip, new_node->node_ip, > INET6_ADDRSTRLEN) == 0)) { > - TRACE("DTM:new_node node already discovered droping > message"); > - TRACE_LEAVE2("sock_desc :%d", sock_desc); > - return sock_desc; > - } else if ((new_node->comm_status == false) && > -((new_node->node_id != node.node_id) || > - (strncmp(node.node_ip, new_node->node_ip, > INET6_ADDRSTRLEN) != 0))) { > - TRACE("DTM:new_node deleting stale enty "); > + } else if ((new_node->comm_status == false) && > ((new_node->node_id != node.node_id) || > + (strncmp(node.node_ip, > new_node->node_ip, INET6_ADDRSTRLEN) != 0))) { > + TRACE("DTM: deleting stale enty node_id :%u, > cluster_id: %d, node_ip:%s", > + node.cluster_id, node.node_id, > node.node_ip); > if (dtm_node_delete(new_node, 0) != NCSCC_RC_SUCCESS) { > LOG_ER("DTM :dtm_node_delete failed (recv())"); > } -- This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 1] osaf: remove nodeinit.conf softlink and from packaging [281]
Ack with the following minor comment. w.r.t @@ -1284,7 +1298,7 @@ int main(int argc, char *argv[]) } if (parse_nodeinit_conf(sbuf) != NCSCC_RC_SUCCESS) { -LOG_ER("Failed to parse " NID_PLAT_CONF " file %s, , exiting", sbuf); +LOG_ER("Failed to parse file %s. Exiting", sbuf); exit(EXIT_FAILURE); } "sbuf" contains err message to print, just not the file-name. But I think it is not required to pass "sbuf" explicitly to function "parse_nodeinit_conf()" and update err-msg, instead do LOG_ERR in this function itself. Thanks, Ramesh. On 6/14/2013 7:23 PM, Hans Feldt wrote: > Ack with same comments as Anders, not tested > /Hans > >> -Original Message- >> From: Mathivanan Naickan Palanivelu [mailto:mathi.naic...@oracle.com] >> Sent: den 14 juni 2013 15:14 >> To: Hans Feldt >> Cc: Ramesh Babu Betham; opensaf-devel@lists.sourceforge.net; Anders >> Widell >> Subject: RE: [PATCH 1 of 1] osaf: remove nodeinit.conf softlink and from >> packaging [281] >> >> Hans, >> >> I'm looking for your Ack too! You wanted this change for a long time! >> >> Cheers, >> Mathi. >> >>> -Original Message- >>> From: Anders Widell [mailto:anders.wid...@ericsson.com] >>> Sent: Friday, June 14, 2013 6:00 PM >>> To: Mathivanan Naickan Palanivelu >>> Cc: hans.fe...@ericsson.com; Ramesh Babu Betham; opensaf- >>> de...@lists.sourceforge.net >>> Subject: Re: [PATCH 1 of 1] osaf: remove nodeinit.conf softlink and >>> from packaging [281] >>> >>> Ack with minor comments >>> >>> I would do: snprintf(nidconf, sizeof(nidconf), ... >>> instead of: snprintf(nidconf, 256, ... >>> >>> this so that the buffer size is specified only at one single place, at >>> the variable definition. >>> >>> regards, >>> Anders Widell >>> >>> On 2013-06-10 18:30, mathi.naic...@oracle.com wrote: 00-README.conf | 28 +++- 00-README.debug | 4 +- README | 8 +++--- opensaf.spec.in | 16 +-- osaf/services/infrastructure/nid/config/Makefile.am | 1 - osaf/services/infrastructure/nid/nodeinit.c | 24 ++-- >> - 6 files changed, 37 insertions(+), 44 deletions(-) This patch removes the softlink creation/packaging of nodeinit.conf. OpenSAF startup will read from the nodeinit.controller file when opensaf-controller rpms are installed and vice-versa from nodeinit.payload file when opensaf-payload rpms are installled. This behaviour is introduced from 4.4(4.2 and 4.3 continue with the old >>> behaviour). During make install, opensaf is setup for a controller installation, in which case user has to set the node_type to configure it as payload >>> during make install. diff --git a/00-README.conf b/00-README.conf --- a/00-README.conf +++ b/00-README.conf @@ -53,13 +53,15 @@ group/user. - Use of MDS subslot ID needs to be enabled, add TIPC_USE_SUBSLOT_ID=YES >> ** >>> * -nodeinit.conf +nodeinit.conf. This is the input file to the Node Initialization Daemon for serializing the opensaf services startup. -NOTE: The interface name and network id arguments to the nid_tipc entry -in nodeinit.conf would get installed with default values. Please change this + stands for 'controller' or 'payload' + +The interface name and network id arguments to the nid_tipc entry +in nodeinit.conf. would get installed with default values. +Please change this accordingly to reflect your correct interface(s) and network-id >>> information. Example 1, single interface: @@ -80,29 +82,19 @@ and let TIPC do the link aggregation. A Also see http://tipc.sourceforge.net/doc/tipc_2.0_users_guide.html -By default `make install' will install pre-configured for a controller node. -i.e. By default, `nodeinit.conf' is a softlink to nodeinit.conf.controller file. -On a payload node, the nodeinit.conf must be a softlink to -nodeinit.conf.payload upon a 'make install'. For e.g.: - -% cd $pkgsysconfdir (e.g. /etc/opensaf/) -% ln -sf nodeinit.conf.payload nodeinit.conf - Please note that OpenSAF recommend users to run TIPC on two separate >>> bearers and let TIPC do the link aggregation. A bonded interface is not recommended. However OpenSAF does not >>> currently support managing two separate TIPC bearers. The missing support is >>> logged i
Re: [devel] [PATCH 1 of 1] osaf: Add time supervision of opensaf_reboot [#437]
Ack. Not tested. 1. CLM case is specific to peer-node reboot, so it does not make any significance. 2. The reboot cases in FM are specific to peer-node reboots, except with the case(s) reboot is triggered on local node where CSI assignments are not yet happened (node is not yet ready). So it is required to evaluate on the impacts of reboot-hang on upcoming node which is currently STDBY node. Regards, Ramesh. On 6/14/2013 7:25 PM, Anders Widell wrote: > I would like to call opensaf_reboot_prepare() in as few services as > possible, since it is a bit dangerous to open the file > /proc/sysrq-trigger and keep it open. In theory, some bug could cause > the program to write to the wrong file descriptor. amfwd is such a > trivial program that the probability for this sort of bug is low. And as > I said in the review mail, it is actually only needed in amfwd. amfnd > already runs as root so it does not need to call this function, and the > other directors can simply call _Exit() and let amfnd take care of the > reboot. > > On the plus side, there is actually also a benefit of keeping > /proc/sysrq-trigger open in amfwd. This means that amfwd will be able to > reboot the node also in the scenario when open() would fail because > there are no free file descriptors available in the kernel. > > regards, > Anders Widell > > On 2013-06-14 15:28, Mathivanan Naickan Palanivelu wrote: >> You are right. I have given up on that. >> However, alternatively What do you think if we move this >> opensaf_reboot_prepare() inside daemonize and >> call it for programs whose basename matches "fmd", "amfwd" and "clmd" ? >> >> Thanks, >> Mathi. >> >>> -Original Message- >>> From: Anders Widell [mailto:anders.wid...@ericsson.com] >>> Sent: Friday, June 14, 2013 5:17 PM >>> To: Mathivanan Naickan Palanivelu >>> Cc: Hans Feldt; opensaf-devel@lists.sourceforge.net >>> Subject: Re: [devel] [PATCH 1 of 1] osaf: Add time supervision of >>> opensaf_reboot [#437] >>> >>> The problem with using capabilities is that we would need to use either >>> libcap >>> or libcap-ng, neither of which is included in LSB. >>> >>> regards, >>> Anders Widell >>> >>> On 2013-06-13 17:39, Mathivanan Naickan Palanivelu wrote: I'm playing with CAP_KILL, CAP_SYS_BOOT and PR_SET_KEEPCAP. Will get back on this patch tomorrow. Cheers. > -Original Message- > From: Mathivanan Naickan Palanivelu > Sent: Thursday, June 13, 2013 8:53 PM > To: Anders Widell; Hans Feldt > Cc: opensaf-devel@lists.sourceforge.net > Subject: RE: [devel] [PATCH 1 of 1] osaf: Add time supervision of > opensaf_reboot [#437] > > I was also looking at CAP_SYS_ADMIN(alternative for > opensaf_reboot_prepare()), as an option until I ran into > https://lwn.net/Articles/486306/! > CAP_SYS_ADMIN would make us vulnerable. > > Cheers, > Mathi. > > >> -Original Message- >> From: Anders Widell [mailto:anders.wid...@ericsson.com] >> Sent: Tuesday, June 11, 2013 1:56 PM >> To: Hans Feldt >> Cc: opensaf-devel@lists.sourceforge.net >> Subject: Re: [devel] [PATCH 1 of 1] osaf: Add time supervision of >> opensaf_reboot [#437] >> >> Maybe I should also point out that the case of getting file >> descriptors 0, 1 or 2 is not just a hypothetical scenario that I >> have dreamed up - it actually happens. The code will not work without >>> the retry. >> I will try to make the code comments more clear, maybe mention the >> daemonize() function instead of just referring to "dropping root >>> privileges". >> regards, >> Anders Widell >> >> On 2013-06-10 17:04, Anders Widell wrote: >>> See comments below. >>> >>> regards, >>> Anders Widell >>> >>> On 2013-06-10 15:47, Hans Feldt wrote: Why is not opensaf_reboot_prepare() called from all contexts? >>> What do you mean by all contexts? It is called by amfwd since it >>> needs to reboot the local node without running as root. As I said >>> in the review mail (but maybe also should go into the commit >>> message), amfd and fmd can simply _Exit() to reboot the local node. >>> This can be a separate enhancement ticket, since it works already >>> now >>> (opensaf_reboot() will exit when the timer has expired). I think the implementation of opensaf_reboot_prepare() requires some comments since it does recursion. I think I understand it but it is just a little to clever to be uncommented... >>> I did put a comment just at the point of recursive call, but maybe >>> it wasn't clear enough? :-) Basically, I don't want to get file >>> descriptors 0, 1 or 2. So if I do get one of those I try again. Why is opensaf_reboot_prepare() called before daemonize()? I guess that should be commented since it is probably important. >>> The comment for opensaf_reboot_prepare() says that it mus
Re: [devel] [PATCH 0 of 7] Review request: logsv: Fix hanging main thread when file i/o don't return
Hi Lennart, My 2 cents... In my opinion, this is one way of handling the parameters/messaging/synchronizations etc. between threads. But not able to correlate why it is not suitable to implement this with LEAP mailbox. At developers discretion, different kinds of implementation can be even followed for other threads that exist today in OpenSAF services. But the architecture, design, implementation of OpenSAF services took some common approach. It is better to maintain consistency even for new feature implementations, unless and until if it is not viable (or) has drastic performance impacts. Best Regards, Ramesh. On 7/5/2013 8:20 PM, Lennart Lund wrote: > In principle I agree with Hans that the best way of implementing inter thread > communication is to use a common design pattern (in OpenSAF LEAP mailbox). > This is for example if there are two threads running in parallel that needs > to communicate and the main synchronization is one thread waiting for a > message from the other thread, but this is not the case in here. > > In order to protect the log server "main thread" (MT) from hanging if a file > operation like write, mkdir etc. does not return, all such operations are > done in a separate "file thread" (FT). > Functions running in the "Main Thread" (MT) that needs file system operations > handle over the execution to the FT when file handling has to be done. > Execution is then given back to the MT again. If a file operation does not > return FT will hang but MT will time out the FT and resume. A timeout will be > handled as a file operation fail. > The MT can detect if the FT is hanging and new requests for file operations > will be "failed". > > The main "communication" between the MT and the FT is synchronization. The MT > is suspended, FT takes over execution (timed out if hanging), MT is resumed > etc. This is handled with condition variable, mutex and synchronization > flags. There is also some parameters that has to be sent from MT to FT and > from FT to MT (this is done very simple). This parameter handling must also > be part of the synchronization, e.g there must be no risk of that a mutex is > locked if the FT hangs. LEAP mailbox is not suitable for this handling. The > code for doing this is not very complicated. Everything is done within two > functions (file_hndl_thread and log_file_api) in file lgs_file.c. The > solution is discussed an confirmed by Anders Widell. > > /Lennart > > >> -Original Message- >> From: Hans Feldt >> Sent: den 5 juli 2013 11:59 >> To: Lennart Lund >> Cc: madhurika.kopp...@oracle.com; opensaf-devel@lists.sourceforge.net >> Subject: RE: [devel] [PATCH 0 of 7] Review request: logsv: Fix hanging main >> thread when file i/o don't return >> >> The LEAP mailbox is not "overkill", it removes the need for locks etc in each >> thread. It is a design pattern used by all services including LOG itself. >> Breaking >> such pattern I don't think is OK for zero benefit. Likely the other way >> around, >> introducing new problems and more code for locking etc. >> /Hans >> >>> -Original Message- >>> From: Lennart Lund >>> Sent: den 5 juli 2013 09:47 >>> To: Hans Feldt >>> Cc: madhurika.kopp...@oracle.com; opensaf-devel@lists.sourceforge.net >>> Subject: RE: [devel] [PATCH 0 of 7] Review request: logsv: Fix hanging >>> main thread when file i/o don't return >>> >>> In this case is the messages are sent in both directions. However it >>> is very "simple" messages and no message queue is needed. To use LEAP >> mailbox would be "overkill" >>> /Lennart >>> -Original Message- From: Hans Feldt Sent: den 20 juni 2013 13:46 To: Lennart Lund Cc: madhurika.kopp...@oracle.com; opensaf-devel@lists.sourceforge.net Subject: Re: [devel] [PATCH 0 of 7] Review request: logsv: Fix hanging main thread when file i/o don't return Why isn't the same design pattern used as in all other services in opensaf - a LEAP mailbox for *message passing* between threads? Thanks, Hans On 06/18/2013 02:54 PM, Lennart Lund wrote: > Summary: logsv: Fix hanging main thread when file i/o don't return > Review request for Trac Ticket(s): #9 Peer Reviewer(s): Madhurika > Koppula, (Anders Widell, Hans Feldt) Pull request to: NA Affected > branch(es): devel (4.4) Development branch: < URL>> > > > Impacted area Impact y/n > >Docsn >Build systemn >RPM/packaging n >Configuration files n >Startup scripts n >SAF servicesy >OpenSAF servicesn >Core libraries n >Samples n >Tests n >Other n > > > Comments (indicate scope for each "y" above): > ---
Re: [devel] [PATCH 1 of 1] fm: Adjust reboot settings in the non-root scenario[#478]
Ack. Thanks, Ramesh. On 7/16/2013 1:37 PM, mathi.naic...@oracle.com wrote: > osaf/services/infrastructure/fm/fms/fm_main.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > > FM needs support for reboot as a non root user to reboot the local node, > when failover is trigerred before the STANDBY node (AMF) is not > completely initialized, FM reboots the local node. > > diff --git a/osaf/services/infrastructure/fm/fms/fm_main.c > b/osaf/services/infrastructure/fm/fms/fm_main.c > --- a/osaf/services/infrastructure/fm/fms/fm_main.c > +++ b/osaf/services/infrastructure/fm/fms/fm_main.c > @@ -90,6 +90,8 @@ int main(int argc, char *argv[]) > int rc = NCSCC_RC_FAILURE; > int term_fd; > > + opensaf_reboot_prepare(); > + > daemonize(argc, argv); > > if (fm_agents_startup() != NCSCC_RC_SUCCESS) { -- See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 1] fm: set rda role when failover is trigerred in the middle of switchover [438]
Mathi, Ack. Not tested. Please see my comments inline [Ramesh]. Thanks, Ramesh. On 7/22/2013 3:49 PM, mathi.naic...@oracle.com wrote: > osaf/services/infrastructure/fm/fms/fm_amf.c | 2 +- > osaf/services/infrastructure/fm/fms/fm_cb.h | 3 + > osaf/services/infrastructure/fm/fms/fm_evt.h | 6 + > osaf/services/infrastructure/fm/fms/fm_main.c | 88 > -- > 4 files changed, 78 insertions(+), 21 deletions(-) > > > diff --git a/osaf/services/infrastructure/fm/fms/fm_amf.c > b/osaf/services/infrastructure/fm/fms/fm_amf.c > --- a/osaf/services/infrastructure/fm/fms/fm_amf.c > +++ b/osaf/services/infrastructure/fm/fms/fm_amf.c > @@ -117,7 +117,7 @@ void fm_saf_CSI_set_callback(SaInvocatio > syslog(LOG_INFO, "fm_saf_CSI_set_callback: Comp %s, state %s", > compName->value, ha_role_string[haState - 1]); > fm_amf_cb = fm_amf_take_hdl(); > if (fm_amf_cb != NULL) { > - fm_cb->role = haState; > + fm_cb->amf_state = haState; > error = saAmfResponse(fm_amf_cb->amf_hdl, invocation, error); > fm_cb->csi_assigned = true; > } [Ramesh]: As we are differentiating RDA/AMF roles through separate variables "amf_state" and "role", I see the variable "csi_assignment" can be removed and instead can use "amf_state" directly. > diff --git a/osaf/services/infrastructure/fm/fms/fm_cb.h > b/osaf/services/infrastructure/fm/fms/fm_cb.h > --- a/osaf/services/infrastructure/fm/fms/fm_cb.h > +++ b/osaf/services/infrastructure/fm/fms/fm_cb.h > @@ -57,6 +57,9 @@ typedef struct fm_cb { > /* Holds own role. */ > PCS_RDA_ROLE role; > > +/* AMF HA state for FM */ > + SaAmfHAStateT amf_state; > + > /* MDS handles. */ > MDS_DEST adest; > MDS_HDL adest_hdl; > diff --git a/osaf/services/infrastructure/fm/fms/fm_evt.h > b/osaf/services/infrastructure/fm/fms/fm_evt.h > --- a/osaf/services/infrastructure/fm/fms/fm_evt.h > +++ b/osaf/services/infrastructure/fm/fms/fm_evt.h > @@ -38,11 +38,16 @@ typedef struct gfm_gfm_msg { > > } GFM_GFM_MSG; > > +typedef struct fm_rda_info_t { > + PCS_RDA_ROLE role; > +} FM_RDA_INFO; > + > /* FM generated events.*/ > typedef enum { > FM_EVT_TMR_EXP, > FM_EVT_NODE_DOWN, > FM_EVT_PEER_UP, > + FM_EVT_RDA_ROLE, > FM_FSM_EVT_MAX > } FM_FSM_EVT_CODE; > > @@ -56,6 +61,7 @@ typedef struct fm_evt { > union { > FM_TMR *fm_tmr; > GFM_GFM_MSG gfm_msg; > + FM_RDA_INFO rda_info; > } info; > } FM_EVT; > > diff --git a/osaf/services/infrastructure/fm/fms/fm_main.c > b/osaf/services/infrastructure/fm/fms/fm_main.c > --- a/osaf/services/infrastructure/fm/fms/fm_main.c > +++ b/osaf/services/infrastructure/fm/fms/fm_main.c > @@ -74,6 +74,39 @@ static void sigusr1_handler(int sig) > ncs_sel_obj_ind(usr1_sel_obj); > } > > +/** > + * Callback from RDA. Post a message/event to the FM mailbox. > + * @param cb_hdl > + * @param cb_info > + * @param error_code > + */ > +static void rda_cb(uint32_t cb_hdl, PCS_RDA_CB_INFO *cb_info, > PCSRDA_RETURN_CODE error_code) > +{ > + uint32_t rc; > + FM_EVT *evt = NULL; > + > + TRACE_ENTER(); > + > + evt = calloc(1, sizeof(FM_EVT)); > + if (NULL == evt) { > + LOG_ER("calloc failed"); > + goto done; > + } > + > + evt->evt_code = FM_EVT_RDA_ROLE; > + evt->info.rda_info.role = cb_info->info.io_role; > + > + rc = ncs_ipc_send(&fm_cb->mbx, (NCS_IPC_MSG *)evt, > MDS_SEND_PRIORITY_HIGH); > + if (rc != NCSCC_RC_SUCCESS) { > + syslog(LOG_ERR, "IPC send failed %d", rc); > + free(evt); > + } > + > + done: > + TRACE_LEAVE(); > +} > + > + > > /* > > PROCEDURE NAME: main > @@ -144,6 +177,11 @@ int main(int argc, char *argv[]) > goto fm_init_failed; > } > > + if ((rc = rda_register_callback(0, rda_cb)) != NCSCC_RC_SUCCESS) { > + syslog(LOG_ERR, "rda_register_callback FAILED %u", rc); > + goto done; > + } > + [Ramesh]: It should be "goto fm_init_failed"; > if ((rc = ncs_sel_obj_create(&usr1_sel_obj)) != NCSCC_RC_SUCCESS) { > LOG_ER("ncs_sel_obj_create FAILED"); > goto fm_init_failed; > @@ -326,27 +364,33 @@ static void fm_mbx_msg_handler(FM_CB *fm > switch (fm_mbx_evt->evt_code) { > case FM_EVT_NODE_DOWN: > LOG_NO("Role: %s, Node Down for node id: %x", > role_string[fm_cb->role], fm_mbx_evt->node_id); > - if ((fm_cb->role == PCS_RDA_STANDBY)||(fm_cb->role == > PCS_RDA_QUIESCED)) { > - if ((fm_mbx_evt->node_id == fm_cb->peer_node_id)) { > - /* Start Promote active timer */ > - if ((fm_cb->role != PCS_RDA_QUIESCED) && > (fm_cb->active_promote_tmr_val != 0)){ > -
Re: [devel] [PATCH 1 of 1] cpsv: create non-collocated replica Imm run-time object maximum on 3 node [#479]
Hi Mahesh, Ack with the following comment. Not tested. if "/noncoll_rep_on_payload/" is `true', then "/nref_info/" and "/cref_info/" should be removed. (or) malloc "/nref_info/" and "/cref_info/" only when /noncoll_rep_on_payload/" is `false' However there are some corrections required in the existing code, found while reviewing in the patch context. --- 1. In function cpd_sb_proc_ckpt_dest_add() line: 499 else { TRACE_4("cpd standby dest add evt failed for ckptid: %llx",msg->info.dest_add.ckpt_id); return NCSCC_RC_OUT_OF_MEM; } Memleak: should free( ) "nref_info" and "cref_info" line: 562 free_mem: if (node_info == NULL) { } Memleak: If line:513 saClmClusterNodeGet() fails, should free "nref_info" and "cref_info" 2. In function cpd_ckpt_reploc_node_delete() line 437: rc = cpd_ckpt_reploc_node_add(&cb->ckpt_reploc_tree, ckpt_reploc_node, cb->ha_state, cb->immOiHandle); Should be removed else.. if "ckpt_reploc_node" has to retain then do not delete it subsequently. 3. In function cpd_ckpt_ref_info_add() , "cref_info" is not added to the list if the same "ckpt_id" exist. In this case we have to free() "cref_info". 4. Similarly, In function cpd_node_ref_info_add() , "nref_info" is not added to the list if the same "dest" exist. In this case we have to free() "nref_info". --- Regards, Ramesh. On 7/26/2013 9:18 AM, mahesh.va...@oracle.com wrote: > osaf/services/saf/cpsv/cpd/cpd_proc.c | 54 > +- > 1 files changed, 39 insertions(+), 15 deletions(-) > > > diff --git a/osaf/services/saf/cpsv/cpd/cpd_proc.c > b/osaf/services/saf/cpsv/cpd/cpd_proc.c > --- a/osaf/services/saf/cpsv/cpd/cpd_proc.c > +++ b/osaf/services/saf/cpsv/cpd/cpd_proc.c > @@ -148,6 +148,7 @@ uint32_t cpd_ckpt_db_entry_update(CPD_CB > SaClmNodeIdT node_id; > SaNameT ckpt_name; > CPD_REP_KEY_INFO key_info; > + bool noncoll_rep_on_payload = false; > > memset(&ckpt_name, 0, sizeof(SaNameT)); > memset(&cluster_node, 0, sizeof(SaClmClusterNodeT)); > @@ -271,13 +272,34 @@ uint32_t cpd_ckpt_db_entry_update(CPD_CB > } > > *o_ckpt_node = ckpt_node; > - if (reploc_info && create_reploc_node) { > - proc_rc = > cpd_ckpt_reploc_node_add(&cb->ckpt_reploc_tree, reploc_info, cb->ha_state, > cb->immOiHandle); > - if (proc_rc != NCSCC_RC_SUCCESS) { > - /* goto reploc_node_add_fail; */ > - TRACE_4("cpd db add failed in db entry update"); > - } > -} > + if (reploc_info && create_reploc_node) { > + /*According to Ckpt non-collocated ckpt implementation > the cluster can have max 3 replicas > + and minimum of 2 replicas,if the non-collocated ckpt > is opened on controller initially , > + by default cpsv service will create 2 replicas each > one on controllers , > + else the non-collocated ckpt is opened on payload > initially,by default cpsv service will create 3 replicas > + one on the payload and other each one on > controllers,so any further opens form any other payload is not > + required to create replicas locally.All other node > ckpt application will access the data form the > + default created active replica. */ > + if > (m_IS_SA_CKPT_CHECKPOINT_COLLOCATED(&(*io_map_info)->attributes)) { > + TRACE_4("Reploc node add for collocated > ckpt_id:%llx",ckpt_id); > + proc_rc = > cpd_ckpt_reploc_node_add(&cb->ckpt_reploc_tree, reploc_info, cb->ha_state, > cb->immOiHandle); > + if (proc_rc != NCSCC_RC_SUCCESS) { > + /* goto reploc_node_add_fail; */ > + TRACE_4("cpd db add failed in db entry > update"); > + } > + } else if > ((cpd_get_slot_sub_id_from_mds_dest(*cpnd_dest) == cb->cpd_remote_id) || > + (cpd_get_slot_sub_id_from_mds_dest(*cpnd_dest) > == cb->cpd_self_id) ) { > + TRACE_4(" reploc node add for non-collocated on > controller ckpt_id:%llx",ckpt_id); > + proc_rc = > cpd_ckpt_reploc_node_add(&cb->ckpt_reploc_tree, reploc_info, cb->ha_state, > cb->immOiHandle); > + if (proc_rc != NCSCC_RC_SUCCESS) { > + /* goto reploc_node_add_fail; */ > +
Re: [devel] [PATCH 1 of 1] leap: ncs_os_process_execute_timed child process takes too long time before exec (#514)
Nagu: Hans N might be pointing to the chances of hung of file-operation calls (esp. when some inconsistency happens with NFS). Just a guess, let Hans N confirm it. Thanks, Ramesh. On 7/30/2013 3:27 PM, Nagendra Kumar wrote: > Hi, > >>> regarding what can "hang" in the child part, e.g close of file descriptors >>> close of file descriptors. > When this can happen? After fork is successful, this shouldn't happen. Can > you please provide any example. > > Thanks > -Nagu > > -Original Message- > From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com] > Sent: 30 July 2013 12:53 > To: Nagendra Kumar > Cc: Hans Nordebäck; opensaf-devel@lists.sourceforge.net; Praveen Malviya; > Ramesh Babu Betham; Hans Feldt > Subject: Re: [PATCH 1 of 1] leap: ncs_os_process_execute_timed child process > takes too long time before exec (#514) > > Hi Nagu, regarding what can "hang" in the child part, e.g close of file > descriptors. /BR HansN On 07/30/13 09:01, Hans Nordebäck wrote: >> Hi Nagu, >> >> On 07/30/13 08:54, Nagendra Kumar wrote: >>> Hi Hans N, >>> > 1. OPENSAF_CHILD_EXEC_TIME_TOLERANCE is the name of a new > environment variable where value is used as input to alarm, if not > set it is default 2 seconds. >>> Do we have some place holder for this variable for configuration and >>> are we going to add it in README for information. >> Perhaps the name isn't the best, but it should be handled as the other >> env variable I guess, e.g. "AVND_PM_MONITORING_RATE", etc. > if the child "hangs" before exec this extra coredump should give > information where/what is wrong. >>> This means that fork hangs, am I right ? If yes, then dump is not >>> going to provide any information as it is a system call, it can only >>> show, ithangs in fork. >> I don't think fork hangs as the parent part continues and later, with >> the help of ncs_exec_mod_hdlr, the parent detects that the child or >> "exec" has timed out, >> 10 sec in this case. But in this case the exec has not been performed. > After exec, it will work as usual >>> This confirms that we are only targeting fork to debug. >> Yes, the extra core dump will help troubleshooting. >> /BR HansN >>> Thanks >>> -Nagu >>> >>> -Original Message- >>> From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com] >>> Sent: 30 July 2013 11:57 >>> To: Nagendra Kumar >>> Cc: opensaf-devel@lists.sourceforge.net; Praveen Malviya; Ramesh Babu >>> Betham; Hans Feldt; Hans Nordebäck >>> Subject: RE: [PATCH 1 of 1] leap: ncs_os_process_execute_timed child >>> process takes too long time before exec (#514) >>> >>> Hi Nagu, >>> >>> 1. OPENSAF_CHILD_EXEC_TIME_TOLERANCE is the name of a new environment >>> variable where value is used as input to alarm, if not set it is >>> default 2 seconds. >>> 2. Yes you are right, in this particular case it is set to 10 sec, >>> that's why the env. variable above can be set. >>> 3. This alarm is just an additional precaution, at no extra cost, to >>> check the child part before the exec. After exec >>>it will work as usual but if the child "hangs" before exec >>> this extra coredump should give information where/what is wrong. >>> >>> /BR HansN >>> >>> -Original Message- >>> From: Nagendra Kumar [mailto:nagendr...@oracle.com] >>> Sent: den 30 juli 2013 07:11 >>> To: Hans Nordebäck; Praveen Malviya; Hans Feldt; Ramesh Babu Betham >>> Cc: opensaf-devel@lists.sourceforge.net >>> Subject: RE: [PATCH 1 of 1] leap: ncs_os_process_execute_timed child >>> process takes too long time before exec (#514) >>> >>> Hi Hans N, >>> For my understanding, can you please provide the below >>> information: >>> >>> 1.I can't find OPENSAF_CHILD_EXEC_TIME_TOLERANCE in opensaf >>> source code. >>> 2.I hope the child process is hung for more than >>> saAmfCtDefClcCliTimeout resulting in CLC time out. Am I right? >>> 3.Even we add assert in child process and we get core dump, but >>> it may not give any information as it got delayed because of >>> system issue. Are we targeting, which system call the child >>> process is hung? >>> >>> Thanks >>> -Nagu >>> >>> -Original Message- >>> From: Hans Nordeback [mailto:hans.nordeb...@ericsson.com] >>> Sent: 22 July 2013 17:07 >>> To: Nagendra Kumar; Praveen Malviya; hans.fe...@ericsson.com; Ramesh >>> Babu Betham >>> Cc: opensaf-devel@lists.sourceforge.net >>> Subject: [PATCH 1 of 1] leap: ncs_os_process_execute_timed child >>> process takes too long time before exec (#514) >>> >>>osaf/libs/core/leap/os_defs.c | 27 +++ >>>1 files changed, 27 insertions(+), 0 deletions(-) >>> >>> >>> amfnd calls ncs_os_process_execute_timed and the child process takes >>> too long time before exec, (10 sec timeout). An alarm is set in the >>> ncs_os_process_execute_timed child process. If timed out a core dump >>> will be produced to be able to trouble shoot. >>> >>> diff --git a/osaf/libs/core/leap/os_defs.c >>> b/osaf/libs/core/le
Re: [devel] [PATCH 1 of 1] leap: ncs_os_process_execute_timed child process takes too long time before exec (#514)
Hi Hans N, My 2 cents.. 1. Instead of LOG_ER() better call sigalrm_handler(0). +if (signal(SIGALRM, sigalrm_handler) == SIG_ERR) { +LOG_ER("signal ALRM failed: %s", strerror(errno)); +} 2. Why cannot the timeout logic can derive/bind directly from/to the timeout value ("i_timeout_in_ms" of NCS_OS_PROC_EXECUTE_TIMED_INFO structure). Say.., Example: alarm_time_sec = (i_timeout_in_ms/2000);/* say (half or lesser) of CLC-CLI timeout value in seconds. */ 3. I prefer the kind of patch should go into a major release (4.4) not for minor releases (4.3.x/4.2.x). Thanks, Ramesh. On 7/22/2013 5:07 PM, Hans Nordeback wrote: > osaf/libs/core/leap/os_defs.c | 27 +++ > 1 files changed, 27 insertions(+), 0 deletions(-) > > > amfnd calls ncs_os_process_execute_timed and the child process takes too long > time before exec, (10 sec timeout). An alarm is set in the > ncs_os_process_execute_timed child process. If timed out a core dump will be > produced to be able to trouble shoot. > > diff --git a/osaf/libs/core/leap/os_defs.c b/osaf/libs/core/leap/os_defs.c > --- a/osaf/libs/core/leap/os_defs.c > +++ b/osaf/libs/core/leap/os_defs.c > @@ -65,6 +65,15 @@ bool gl_ncs_atomic_mtx_initialise = fals >* description of SOCK_CLOEXEC. */ > static pthread_mutex_t s_cloexec_mutex = PTHREAD_MUTEX_INITIALIZER; > > +/* > + * ALRM signal is used to detect if child process takes too long time before > exec. > + * > + * @param sig > + */ > +static void sigalrm_handler(int sig) > +{ > + abort(); > +} > /*** >* >* uns64 > @@ -999,6 +1008,22 @@ uint32_t ncs_os_process_execute_timed(NC > osaf_mutex_lock_ordie(&s_cloexec_mutex); > > if ((pid = fork()) == 0) { > +unsigned int alarm_time_sec; > +char* alarm_time; > + > +if (signal(SIGALRM, sigalrm_handler) == SIG_ERR) { > +LOG_ER("signal ALRM failed: %s", strerror(errno)); > +} > +if ((alarm_time = > getenv("OPENSAF_CHILD_EXEC_TIME_TOLERANCE")) != NULL) { > +alarm_time_sec = strtol(alarm_time, NULL, 0); > +} > +else { > +// default alarm timeout 2 seconds > +alarm_time_sec = 2; > +} > + > +alarm(alarm_time_sec); > + > /* >** Make sure forked processes have default scheduling class >** independent of the callers scheduling class. > @@ -1054,6 +1079,8 @@ uint32_t ncs_os_process_execute_timed(NC > } > #endif > > +alarm(0); > + > /* child part */ > if (execvp(req->i_script, req->i_argv) == -1) { > syslog(LOG_ERR, "%s: execvp '%s' failed - %s", > __FUNCTION__, req->i_script, strerror(errno)); -- Get your SQL database under version control now! Version control is standard for application code, but databases havent caught up. So what steps can you take to put your SQL databases under version control? Why should you start doing it? Read more to find out. http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 1] leap: ncs_os_process_execute_timed child process takes too long time before exec (#514)
It may not be exactly with fork(), after fork() say.. if (freopen("/dev/null", "r", stdin) == NULL) *syslog(LOG_ERR, "%s: freopen stdin failed - %s", __FUNCTION__, strerror(errno));* if (freopen("/dev/null", "w", stdout) == NULL) syslog(LOG_ERR, "%s: freopen stdout failed - %s", __FUNCTION__, strerror(errno)); if (freopen("/dev/null", "w", stderr) == NULL) But if this is the scenario been observed (a hung), let the CLC-CLI timeout and take subsequent action rather than forcing to abort. What do you say? Thanks, Ramesh. On 7/30/2013 4:04 PM, Nagendra Kumar wrote: > But where are file operations coming during fork, can you please explain ? > > Thanks > -Nagu > -Original Message- > From: Ramesh Betham > Sent: 30 July 2013 15:53 > To: Nagendra Kumar > Cc: Hans Nordebäck; opensaf-devel@lists.sourceforge.net; Praveen Malviya; > Hans Feldt > Subject: Re: [PATCH 1 of 1] leap: ncs_os_process_execute_timed child process > takes too long time before exec (#514) > > Nagu: Hans N might be pointing to the chances of hung of file-operation calls > (esp. when some inconsistency happens with NFS). Just a guess, let Hans N > confirm it. > > Thanks, > Ramesh. > > On 7/30/2013 3:27 PM, Nagendra Kumar wrote: >> Hi, >> >>>> regarding what can "hang" in the child part, e.g close of file descriptors >>>> close of file descriptors. >> When this can happen? After fork is successful, this shouldn't happen. Can >> you please provide any example. >> >> Thanks >> -Nagu >> >> -Original Message- >> From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com] >> Sent: 30 July 2013 12:53 >> To: Nagendra Kumar >> Cc: Hans Nordebäck; opensaf-devel@lists.sourceforge.net; Praveen >> Malviya; Ramesh Babu Betham; Hans Feldt >> Subject: Re: [PATCH 1 of 1] leap: ncs_os_process_execute_timed child >> process takes too long time before exec (#514) >> >> Hi Nagu, regarding what can "hang" in the child part, e.g close of file >> descriptors. /BR HansN On 07/30/13 09:01, Hans Nordebäck wrote: >>> Hi Nagu, >>> >>> On 07/30/13 08:54, Nagendra Kumar wrote: >>>> Hi Hans N, >>>> >>>>>> 1. OPENSAF_CHILD_EXEC_TIME_TOLERANCE is the name of a new >>>>>> environment variable where value is used as input to alarm, if >>>>>> not set it is default 2 seconds. >>>> Do we have some place holder for this variable for configuration and >>>> are we going to add it in README for information. >>> Perhaps the name isn't the best, but it should be handled as the >>> other env variable I guess, e.g. "AVND_PM_MONITORING_RATE", etc. >>>>>> if the child "hangs" before exec this extra coredump should give >>>>>> information where/what is wrong. >>>> This means that fork hangs, am I right ? If yes, then dump is not >>>> going to provide any information as it is a system call, it can only >>>> show, ithangs in fork. >>> I don't think fork hangs as the parent part continues and later, with >>> the help of ncs_exec_mod_hdlr, the parent detects that the child or >>> "exec" has timed out, >>> 10 sec in this case. But in this case the exec has not been performed. >>>>>> After exec, it will work as usual >>>> This confirms that we are only targeting fork to debug. >>> Yes, the extra core dump will help troubleshooting. >>> /BR HansN >>>> Thanks >>>> -Nagu >>>> >>>> -Original Message- >>>> From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com] >>>> Sent: 30 July 2013 11:57 >>>> To: Nagendra Kumar >>>> Cc: opensaf-devel@lists.sourceforge.net; Praveen Malviya; Ramesh >>>> Babu Betham; Hans Feldt; Hans Nordebäck >>>> Subject: RE: [PATCH 1 of 1] leap: ncs_os_process_execute_timed child >>>> process takes too long time before exec (#514) >>>> >>>> Hi Nagu, >>>> >>>> 1. OPENSAF_CHILD_EXEC_TIME_TOLERANCE is the name of a new >>>> environment variable where value is used as input to alarm, if not >>>> set it is default 2 seconds. >>>> 2. Yes you are right, in this particular case it is set to 10 sec, >>>> that's why the env. variable above can be set. >>>> 3. This al
Re: [devel] [PATCH 1 of 1] leap: ncs_os_process_execute_timed child process takes too long time before exec (#514)
TCH 1 of 1] leap: ncs_os_process_execute_timed child process takes too long time before exec (#514) Hi Nagu, I have tested the patch and simulated "hanging" in the child part, the core dump produced points out where. The system works as before, exept the core dump if it hangs in the child part. We have this patch running at a site waiting for it to trigger, so we don't know yet what is causing this and if the patch will help. /BR HansN -Original Message- From: Nagendra Kumar [mailto:nagendr...@oracle.com] Sent: den 30 juli 2013 13:05 To: Hans Nordebäck Cc: Ramesh Babu Betham; opensaf-devel@lists.sourceforge.net; Praveen Malviya; Hans Feldt Subject: RE: [PATCH 1 of 1] leap: ncs_os_process_execute_timed child process takes too long time before exec (#514) Hi Hans N, Close is not a sync call. I am still not convinced, these calls may get blocked because of NFS system issue. Have you tested by keeping abort in child process and see how amfnd or other services behaves(just to simulate abort)? Thanks -Nagu -Original Message- From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com] Sent: 30 July 2013 16:16 To: Nagendra Kumar Cc: Ramesh Babu Betham; opensaf-devel@lists.sourceforge.net; Praveen Malviya; Hans Feldt Subject: Re: [PATCH 1 of 1] leap: ncs_os_process_execute_timed child process takes too long time before exec (#514) Hi Nagu, I agree with Ramesh, e.g. in the child part: /* By default we close all inherited file descriptors in the child */ if (getenv("OPENSAF_KEEP_FD_OPEN_AFTER_FORK") == NULL) { /* Close all inherited file descriptors */ int i = sysconf(_SC_OPEN_MAX); if (i == -1) { syslog(LOG_ERR, "%s: sysconf failed - %s", __FUNCTION__, strerror(errno)); exit(EXIT_FAILURE); } for (i--; i >= 0; --i) (void) close(i); /* close all descriptors */ /* Redirect standard files to /dev/null */ if (freopen("/dev/null", "r", stdin) == NULL) syslog(LOG_ERR, "%s: freopen stdin failed - %s", __FUNCTION__, strerror(errno)); if (freopen("/dev/null", "w", stdout) == NULL) syslog(LOG_ERR, "%s: freopen stdout failed - %s", __FUNCTION__, strerror(errno)); if (freopen("/dev/null", "w", stderr) == NULL) syslog(LOG_ERR, "%s: freopen stderr failed - %s", __FUNCTION__, strerror(errno)); } close are issued. /BR HansN On 07/30/13 12:34, Nagendra Kumar wrote: But where are file operations coming during fork, can you please explain ? Thanks -Nagu -Original Message- From: Ramesh Betham Sent: 30 July 2013 15:53 To: Nagendra Kumar Cc: Hans Nordebäck; opensaf-devel@lists.sourceforge.net; Praveen Malviya; Hans Feldt Subject: Re: [PATCH 1 of 1] leap: ncs_os_process_execute_timed child process takes too long time before exec (#514) Nagu: Hans N might be pointing to the chances of hung of file-operation calls (esp. when some inconsistency happens with NFS). Just a guess, let Hans N confirm it. Thanks, Ramesh. On 7/30/2013 3:27 PM, Nagendra Kumar wrote: Hi, regarding what can "hang" in the child part, e.g close of file descriptors close of file descriptors. When this can happen? After fork is successful, this shouldn't happen. Can you please provide any example. Thanks -Nagu -Original Message- From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com] Sent: 30 July 2013 12:53 To: Nagendra Kumar Cc: Hans Nordebäck; opensaf-devel@lists.sourceforge.net; Praveen Malviya; Ramesh Babu Betham; Hans Feldt Subject: Re: [PATCH 1 of 1] leap: ncs_os_process_execute_timed child process takes too long time before exec (#514) Hi Nagu, regarding what can "hang" in the child part, e.g close of file descriptors. /BR HansN On 07/30/13 09:01, Hans Nordebäck wrote: Hi Nagu, On 07/30/13 08:54, Nagendra Kumar wrote: Hi Hans N, 1. OPENSAF_CHILD_EXEC_TIME_TOLERANCE is the name of a new environment variable where value is used as input to alarm, if not set it is default 2 seconds. Do we have some place holder for this variable for configuration and are we going to add it in README for information. Perhaps the name isn't the best, but it should be handled as the other env variable I guess, e.g. "AVND_PM_MONITORING_RATE", etc. if the child "hangs" before exec this extra coredump should give information where/what is wrong. This means that fork hangs, am I right ? If yes, then dump is not going to provide any information as it is a system call, it can only show, ithangs in fork. I don't think fork hangs as the parent part continues and later, with the help of ncs_exec_mod_hdlr, the parent detects that the child or "ex
Re: [devel] [PATCH 1 of 1] leap: ncs_os_process_execute_timed child process takes too long time before exec (#514)
My final comments (preceded by [Ramesh]):-). On 8/7/2013 2:21 PM, Hans Nordebäck wrote: > Hi, sorry I forgot it, I add my comments below, (preceeded by HansN): > >> " >> My 2 cents.. >> 1. Instead of LOG_ER() better call sigalrm_handler(0). > HansN: I think it is good to have sigalrm active, but if signal fails it > is not fatal and a log message should be enough, and then continue with exec > instead of aborting. > >> +if (signal(SIGALRM, sigalrm_handler) == SIG_ERR) { >> +LOG_ER("signal ALRM failed: %s", strerror(errno)); >> +} [Ramesh]: Intention behind this comment is, as the patch is trying to handle the case were "syslog" or any "fd" write blocks.. then generate a core-dump. So having "LOG_ER", the significance of this patch is lost as it may even block at LOG_ER. >> 2. Why cannot the timeout logic can derive/bind directly from/to the timeout >> value ("i_timeout_in_ms" of NCS_OS_PROC_EXECUTE_TIMED_INFO structure). >> Say.., >> Example: alarm_time_sec = (i_timeout_in_ms/2000);/* say >> (half or lesser) of CLC-CLI timeout value in seconds. */ > HansN: I guess the time to run the child part before exec should be short > and the timeout value should determined by "osaf" and not the configuration > of an application, that also may vary from very short to very long > timeout values. > >> 3. I prefer the kind of patch should go into a major release (4.4) not for >> minor releases (4.3.x/4.2.x). > HansN: ok, but we have several faults reported related to this, so it would > be good to apply the patch. [Ramesh]: Can push it, but this patch requires more testing. > Thanks, > Ramesh. > " > > /BR HansN > > -Original Message- > From: Ramesh Betham [mailto:ramesh.bet...@oracle.com] > Sent: den 7 augusti 2013 10:34 > To: Hans Nordebäck > Cc: Nagendra Kumar; opensaf-devel@lists.sourceforge.net; Hans Feldt; Anders > Widell > Subject: Re: SV: [PATCH 1 of 1] leap: ncs_os_process_execute_timed child > process takes too long time before exec (#514) > > Can you please provide your opinion on my initial comments (mail-attached). > > Thanks, > Ramesh. > > On 8/7/2013 1:43 PM, Hans Nordebäck wrote: >> Hi, what is the conclusion, can this patch be acked? /BR HansN >> >> -Original Message- >> From: Hans Nordebäck >> Sent: den 6 augusti 2013 16:41 >> To: praveen malviya >> Cc: Nagendra Kumar; Ramesh Babu Betham; >> opensaf-devel@lists.sourceforge.net; Hans Feldt; Anders Widell; Hans >> Nordebäck >> Subject: RE: SV: [PATCH 1 of 1] leap: ncs_os_process_execute_timed >> child process takes too long time before exec (#514) >> >> the fault described below is related to ticket #532. /HansN >> >> -Original Message- >> From: Hans Nordebäck >> Sent: den 6 augusti 2013 16:28 >> To: praveen malviya >> Cc: Nagendra Kumar; Ramesh Babu Betham; >> opensaf-devel@lists.sourceforge.net; Hans Feldt; Anders Widell; Hans >> Nordebäck >> Subject: RE: SV: [PATCH 1 of 1] leap: ncs_os_process_execute_timed >> child process takes too long time before exec (#514) >> >> Hi, Yes, it seems most likely that the child is "hanging" somewhere before >> exec, if it had crashed it should be a sigchld sent, which not seems to be >> the case here. >> Then the alarm patch needs to be applied I guess to detect where it is >> "hanging". >> >>/BR HansN >> >> -Original Message- >> From: praveen malviya [mailto:praveen.malv...@oracle.com] >> Sent: den 6 augusti 2013 09:34 >> To: Hans Nordebäck >> Cc: Nagendra Kumar; Ramesh Babu Betham; >> opensaf-devel@lists.sourceforge.net; Hans Feldt; Anders Widell >> Subject: Re: SV: [PATCH 1 of 1] leap: ncs_os_process_execute_timed >> child process takes too long time before exec (#514) >> >> Hi, >>I added a new syslog entry(to debug) before execv and was able to >> reproduce the problem. >> The reason for the time out seems to be that syslog was *hung*, but >> *after* writing the new log message into /var/log/messages. >> So, there is a high possibility that the child process gets hung in syslog >> or other file operations. >> See bt below: >> Thread 1 (Thread 0x7f030a16f700 (LWP 16331)): >> >> #0 0x7f0308de4b1e in __lll_lock_wait_private () from >> /lib64/libc.so.6 >> #1 0x7f0308dd4398 in _L_lock_634 () from /lib64/libc.so.6 >> #2 0x7f0308dd3e62 in __vsyslog_chk () fro
Re: [devel] [PATCH 1 of 1] base: use SCHED_RESET_ON_FORK in daemonize [#532]
Hi Hans, The reason for code existing to the failure of "sched_setscheduler()" is to continue with *default values* by any chance if it fails with the user defined values given through env-var settings "*__SCHED_PRIORITY" and "*_SCHED_POLICY". Thanks, Ramesh. On 9/18/2013 2:49 PM, Hans Feldt wrote: > osaf/libs/core/common/daemon.c | 23 ++- > osaf/libs/core/leap/os_defs.c | 8 > 2 files changed, 18 insertions(+), 13 deletions(-) > > > In ncs_os_process_execute_timed() non async signal safe functions are used > between fork() and exec(). That can cause undeterministic behaviour in the > child and cause problems for AMF to provide service. > > The amfnd main thread runs with RT scheduling policy and > ncs_os_process_execute_timed() needs to guarantee that child processes get > normal scheduling policy and not just inherits the callers policy. > > By adding the SCHED_RESET_ON_FORK option to the sched_setscheduler system call > it is guaranteed by the kernel that all child processes gets normal > scheduling policy. No matter the policy of the parent process/thread. > > diff --git a/osaf/libs/core/common/daemon.c b/osaf/libs/core/common/daemon.c > --- a/osaf/libs/core/common/daemon.c > +++ b/osaf/libs/core/common/daemon.c > @@ -40,6 +40,15 @@ > #include > #include > > +/* > + * See "man 2 sched_setscheduler" > + * SCHED_RESET_ON_FORK is supported from Linux 2.6.32 but is not in POSIX > (yet) > + * SCHED_RESET_ON_FORK is defined in > + * The above file cannot be included because it will break an LSB build > + * We trust that the Linux kernel ABI will never change and is backwards > + * compatible thus it is safe to define our own constant here. > + */ > +#define SCHED_RESET_ON_FORK 0x4000 > > #define DEFAULT_RUNAS_USERNAME "opensaf" > > @@ -216,6 +225,7 @@ void daemonize(int argc, char *argv[]) > { > policy = SCHED_RR; > prio_val = sched_get_priority_min(policy); > + policy |= SCHED_RESET_ON_FORK; > } > > strcpy(t_str, basename(argv[0])); > @@ -235,14 +245,17 @@ void daemonize(int argc, char *argv[]) > > param.sched_priority = prio_val; > if (sched_setscheduler(0, policy, ¶m) == -1) { > - syslog(LOG_ERR, "Could not set scheduling class for %s", > strerror(errno)); > + syslog(LOG_ERR, "daemonize: could not set scheduling class - > %s", strerror(errno)); > if( (!strncmp("osafamfwd", basename(argv[0]), 9)) || > (!strncmp("osafamfnd", basename(argv[0]), 9))) > { > - policy = SCHED_RR; > + syslog(LOG_NOTICE, "daemonize: setting scheduler policy > to OTHER"); > + syslog(LOG_WARNING, "daemonize: this system is not > correctly configured"); > + policy = SCHED_OTHER; > param.sched_priority = sched_get_priority_min(policy); > - syslog(LOG_INFO, "setting to default values"); > - if (sched_setscheduler(0, policy, ¶m) == -1) > - syslog(LOG_ERR, "Could not set scheduling class > for %s", strerror(errno)); > + if (sched_setscheduler(0, policy, ¶m) == -1) { > + syslog(LOG_ERR, "daemonize: could not set > scheduling class, exiting"); > + exit(EXIT_FAILURE); > + } > } > } > > diff --git a/osaf/libs/core/leap/os_defs.c b/osaf/libs/core/leap/os_defs.c > --- a/osaf/libs/core/leap/os_defs.c > +++ b/osaf/libs/core/leap/os_defs.c > @@ -999,14 +999,6 @@ uint32_t ncs_os_process_execute_timed(NC > osaf_mutex_lock_ordie(&s_cloexec_mutex); > > if ((pid = fork()) == 0) { > - /* > - ** Make sure forked processes have default scheduling class > - ** independent of the callers scheduling class. > - */ > - struct sched_param param = {.sched_priority = 0 }; > - if (sched_setscheduler(0, SCHED_OTHER, ¶m) == -1) > - syslog(LOG_ERR, "%s: Could not setscheduler: %s", > __FUNCTION__, strerror(errno)); > - > /* set the environment variables */ > for (; count > 0; count--) { > setenv(node->name, node->value, node->overwrite); -- LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourcef
Re: [devel] [PATCH 1 of 1] base: use SCHED_RESET_ON_FORK in daemonize [#532]
How about the other way. Keeping the new changes in "ifdef". Let we leave to the end-user discretion on setting this flag (based on their kernel version). README can provide the update on this flag saying., to set this flag and check if user observe hang in fork-exec. Regards, Ramesh. On 9/19/2013 1:01 PM, Hans Feldt wrote: > The only problem here is the kernel requirement 2.6.32 > > http://wiki.novell.com/index.php/Kernel_versions > https://access.redhat.com/site/articles/3078 > http://www.windriver.com/announces/linux4/ > > system requirements would be SLES11-SP1, RHEL6 and WRL4 > > I am not sure how to go about this. Worst case we have to keep the old > code behind some ifdefs > > Thanks, > Hans > > > On 09/18/2013 06:17 PM, Ramesh Babu Betham wrote: >> Yes. Ack. >> >> Regards, >> Ramesh. >> >> - Original Message - >> From: hans.fe...@ericsson.com >> To: ramesh.bet...@oracle.com >> Cc: osafde...@gmail.com, opensaf-devel@lists.sourceforge.net >> Sent: Wednesday, September 18, 2013 9:16:06 PM GMT +05:30 Chennai, >> Kolkata, Mumbai, New Delhi >> Subject: RE: [devel] [PATCH 1 of 1] base: use SCHED_RESET_ON_FORK in >> daemonize [#532] >> >> OK is this an ack? >> Thanks, >> Hans >> >>> -Original Message- >>> From: Ramesh Babu Betham [mailto:ramesh.bet...@oracle.com] >>> Sent: den 18 september 2013 17:42 >>> To: Hans Feldt >>> Cc: osafde...@gmail.com; opensaf-devel@lists.sourceforge.net >>> Subject: Re: [devel] [PATCH 1 of 1] base: use SCHED_RESET_ON_FORK in >>> daemonize [#532] >>> >>> Yes, you are correct. Below mentioned change is enough. >>> >>>> +policy |= SCHED_RESET_ON_FORK; >>> >>> Regards, >>> Ramesh. >>> >>> >>> - Original Message - >>> From: hans.fe...@ericsson.com >>> To: ramesh.bet...@oracle.com, osafde...@gmail.com >>> Cc: opensaf-devel@lists.sourceforge.net >>> Sent: Wednesday, September 18, 2013 5:34:05 PM GMT +05:30 Chennai, >>> Kolkata, Mumbai, New Delhi >>> Subject: RE: [devel] [PATCH 1 of 1] base: use SCHED_RESET_ON_FORK in >>> daemonize [#532] >>> >>> OK I thought it was reverting back to defaults due to system limits >>> or something. Not that some user had configured it wrong. I get it, >>> should remove all changes in daemoniz() except: >>>>> +policy |= SCHED_RESET_ON_FORK; >>> >>> Ok? >>> >>> Thanks, >>> Hans >>> >>>> -Original Message- >>>> From: Ramesh Betham [mailto:ramesh.bet...@oracle.com] >>>> Sent: den 18 september 2013 13:51 >>>> To: Hans Feldt >>>> Cc: opensaf-devel@lists.sourceforge.net >>>> Subject: Re: [devel] [PATCH 1 of 1] base: use SCHED_RESET_ON_FORK >>>> in daemonize [#532] >>>> >>>> Hi Hans, >>>> >>>> The reason for code existing to the failure of >>>> "sched_setscheduler()" is >>>> to continue with *default values* by any chance if it fails with the >>>> user defined values given through env-var settings "*__SCHED_PRIORITY" >>>> and "*_SCHED_POLICY". >>>> >>>> Thanks, >>>> Ramesh. >>>> >>>> On 9/18/2013 2:49 PM, Hans Feldt wrote: >>>>>osaf/libs/core/common/daemon.c | 23 ++- >>>>>osaf/libs/core/leap/os_defs.c | 8 >>>>>2 files changed, 18 insertions(+), 13 deletions(-) >>>>> >>>>> >>>>> In ncs_os_process_execute_timed() non async signal safe functions >>>>> are used >>>>> between fork() and exec(). That can cause undeterministic >>>>> behaviour in the >>>>> child and cause problems for AMF to provide service. >>>>> >>>>> The amfnd main thread runs with RT scheduling policy and >>>>> ncs_os_process_execute_timed() needs to guarantee that child >>>>> processes get >>>>> normal scheduling policy and not just inherits the callers policy. >>>>> >>>>> By adding the SCHED_RESET_ON_FORK option to the sched_setscheduler >>>>> system call >>>>> it is guaranteed by the kernel that all child processes gets normal >>>>> scheduling policy. No matter the policy of the parent process/thread. >>>>> >>>&g
Re: [devel] [PATCH 1 of 1] base: Fix build problem due to missing include [#2026]
Ack. Thanks, Ramesh. On 9/12/2016 5:03 PM, Anders Widell wrote: > osaf/libs/core/common/include/osaf_poll.h | 3 ++- > osaf/libs/core/common/osaf_poll.c | 4 ++-- > 2 files changed, 4 insertions(+), 3 deletions(-) > > > diff --git a/osaf/libs/core/common/include/osaf_poll.h > b/osaf/libs/core/common/include/osaf_poll.h > --- a/osaf/libs/core/common/include/osaf_poll.h > +++ b/osaf/libs/core/common/include/osaf_poll.h > @@ -25,8 +25,9 @@ > #define OPENSAF_BASE_OSAF_POLL_H_ > > #include > +#include > +#include > #include > -#include > > #ifdef __cplusplus > extern "C" { > diff --git a/osaf/libs/core/common/osaf_poll.c > b/osaf/libs/core/common/osaf_poll.c > --- a/osaf/libs/core/common/osaf_poll.c > +++ b/osaf/libs/core/common/osaf_poll.c > @@ -15,12 +15,12 @@ >* >*/ > > +#include "osaf_poll.h" > #include > #include > +#include "logtrace.h" > #include "osaf_time.h" > #include "osaf_utility.h" > -#include "logtrace.h" > -#include "osaf_poll.h" > > > static unsigned osaf_poll_no_timeout(struct pollfd* io_fds, nfds_t i_nfds); -- ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1 of 1] msg: memset ilist_info and track_info to avoid garbage [#2000]
osaf/services/saf/mqsv/mqd/mqd_mbcsv.c | 4 1 files changed, 4 insertions(+), 0 deletions(-) Garbage value causing the problem so memset() will fix the issue diff --git a/osaf/services/saf/mqsv/mqd/mqd_mbcsv.c b/osaf/services/saf/mqsv/mqd/mqd_mbcsv.c --- a/osaf/services/saf/mqsv/mqd/mqd_mbcsv.c +++ b/osaf/services/saf/mqsv/mqd/mqd_mbcsv.c @@ -1155,6 +1155,8 @@ static uint32_t mqd_copy_data_to_cold_sy LOG_CR("%s:%u: ERR_MEMORY: Failed To Allocate Memory", __FILE__, __LINE__); return SA_AIS_ERR_NO_MEMORY; } + + memset(mbcsv_info->ilist_info, 0, mbcsv_info->ilist_cnt * sizeof(SaNameT)); } mbcsv_info->track_cnt = obj_info->tlist.count; if (mbcsv_info->track_cnt) { @@ -1164,6 +1166,8 @@ static uint32_t mqd_copy_data_to_cold_sy LOG_CR("%s:%u: ERR_MEMORY: Failed To Allocate Memory", __FILE__, __LINE__); return SA_AIS_ERR_NO_MEMORY; } + + memset(mbcsv_info->track_info, 0, mbcsv_info->track_cnt * sizeof(MQD_A2S_TRACK_INFO)); } itr.state = 0; -- ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 0 of 1] Review Request for msg: memset ilist_info and track_info to avoid garbage [#2000]
Summary:msg: memset ilist_info and track_info to avoid garbage [#2000] Review request for Trac Ticket(s): #2000 Peer Reviewer(s): Ramesh Pull request to: <> Affected branch(es): 5.1 & default Development branch: default Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesn OpenSAF servicesy Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - changeset 3c501998addd34e918f2c8d2c9f58c0099b76d02 Author: Ramesh Date: Tue, 13 Sep 2016 10:56:28 +0530 msg: memset ilist_info and track_info to avoid garbage [#2000] Garbage value causing the problem so memset() will fix the issue Complete diffstat: -- osaf/services/saf/mqsv/mqd/mqd_mbcsv.c | 4 1 files changed, 4 insertions(+), 0 deletions(-) Testing Commands: - <> Testing, Expected Results: -- <> Conditions of Submission: - <> Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.hgrc file (i.e. username, email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. -- ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 0 of 1] Review Request for base: Add classes for UNIX socket operations and log message formatting [#2064]
HI Anders, Will try to provide my review comments next week. Regards, Ramesh. On 10/13/2016 9:22 PM, Anders Widell wrote: > Hi Ramesh! > > Did you get a chance to look at this yet? > > regards, > > Anders Widell > > > On 10/10/2016 04:54 PM, Anders Widell wrote: >> Summary: base: Add classes for UNIX socket operations and log message >> formatting [#2064] >> Review request for Trac Ticket(s): 2064 >> Peer Reviewer(s): Ramesh >> Pull request to: >> Affected branch(es): default(5.2) >> Development branch: default >> >> >> Impacted area Impact y/n >> >> Docsn >> Build systemn >> RPM/packaging n >> Configuration files n >> Startup scripts n >> SAF servicesn >> OpenSAF servicesn >> Core libraries y >> Samples n >> Tests n >> Other n >> >> >> Comments (indicate scope for each "y" above): >> - >> v2: >> >> * Fix bugs in time stamp formatting (wrong seconds, missing validation >>of input parameters) >> * Added a few more test cases for time stamp formatting >> >> changeset ea286178e02720d7d8859d4eabfbed785f48321a >> Author:Anders Widell >> Date:Mon, 10 Oct 2016 16:50:15 +0200 >> >> base: Add classes for UNIX socket operations and log message >> formatting >> [#2064] >> >> Add support classes for using UNIX sockets, and for formatting >> log messages >> according to rfc5424. >> >> >> Complete diffstat: >> -- >> osaf/libs/core/cplusplus/base/Makefile.am | 13 >> - >> osaf/libs/core/cplusplus/base/buffer.h | 100 >> +++ >> >> osaf/libs/core/cplusplus/base/log_message.cc| 130 >> ++ >> >> >> osaf/libs/core/cplusplus/base/log_message.h | 186 >> + >> >> >> osaf/libs/core/cplusplus/base/tests/Makefile.am | 12 >> +--- >> osaf/libs/core/cplusplus/base/tests/log_message_test.cc | 150 >> + >> >> >> osaf/libs/core/cplusplus/base/unix_client_socket.cc | 52 >> +++ >> osaf/libs/core/cplusplus/base/unix_client_socket.h | 41 >> +++ >> osaf/libs/core/cplusplus/base/unix_server_socket.cc | 51 >> ++ >> osaf/libs/core/cplusplus/base/unix_server_socket.h | 42 >> +++ >> osaf/libs/core/cplusplus/base/unix_socket.cc| 58 >> +++ >> osaf/libs/core/cplusplus/base/unix_socket.h | 89 >> +++ >> 12 files changed, 917 insertions(+), 7 deletions(-) >> >> >> Testing Commands: >> - >> make check >> >> >> Testing, Expected Results: >> -- >> All unit tests should pass >> >> >> Conditions of Submission: >> - >> Ack from reviewer(s) >> >> >> Arch Built StartedLinux distro >> --- >> mipsn n >> mips64 n n >> x86 n n >> x86_64 y y >> powerpc n n >> powerpc64 n n >> >> >> Reviewer Checklist: >> --- >> [Submitters: make sure that your review doesn't trigger any checkmarks!] >> >> >> Your checkin has not passed review because (see checked entries): >> >> ___ Your RR template is generally incomplete; it has too many blank >> entries >> that need proper data filled in. >> >> ___ You have failed to nominate the proper persons for review and push. >> >> ___ Your patches do not have proper short+long header >> >> ___ You have grammar/spelling in your header that is unacceptable. >> >> ___ You have exceeded a sensible line length in your >> headers/comments/text. >> >> ___ You have failed to put in a proper Trac Ticket # into your commits. >> >> ___ You have incorrectly put/left internal data in your comments/files >> (i.e. internal bug tracking tool IDs, product names etc) >> >> ___ You have not given any evidence of testing beyond basic build tests. >> Demonstrate some level of runtime or other sanity testing. >> >> ___ You have ^M present in some of your files. These have to be removed. >> >> ___ You have needlessly changed whitespace or added whitespace crimes >> like trailing spaces, or space
Re: [devel] [PATCH 1 of 1] base: Add classes for UNIX socket operations and log message formatting [#2064]
Ack. Thanks, Ramesh. On 10/10/2016 8:24 PM, Anders Widell wrote: > osaf/libs/core/cplusplus/base/Makefile.am | 13 +- > osaf/libs/core/cplusplus/base/buffer.h | 100 > osaf/libs/core/cplusplus/base/log_message.cc| 130 +++ > osaf/libs/core/cplusplus/base/log_message.h | 186 > > osaf/libs/core/cplusplus/base/tests/Makefile.am | 12 +- > osaf/libs/core/cplusplus/base/tests/log_message_test.cc | 150 > osaf/libs/core/cplusplus/base/unix_client_socket.cc | 52 > osaf/libs/core/cplusplus/base/unix_client_socket.h | 41 +++ > osaf/libs/core/cplusplus/base/unix_server_socket.cc | 51 > osaf/libs/core/cplusplus/base/unix_server_socket.h | 42 +++ > osaf/libs/core/cplusplus/base/unix_socket.cc| 58 > osaf/libs/core/cplusplus/base/unix_socket.h | 89 +++ > 12 files changed, 917 insertions(+), 7 deletions(-) > > > Add support classes for using UNIX sockets, and for formatting log messages > according to rfc5424. > > diff --git a/osaf/libs/core/cplusplus/base/Makefile.am > b/osaf/libs/core/cplusplus/base/Makefile.am > --- a/osaf/libs/core/cplusplus/base/Makefile.am > +++ b/osaf/libs/core/cplusplus/base/Makefile.am > @@ -23,10 +23,15 @@ DEFAULT_INCLUDES = > SUBDIRS = tests > > noinst_HEADERS = \ > + buffer.h \ > getenv.h \ > + log_message.h \ > macros.h \ > process.h \ > - time.h > + time.h \ > + unix_client_socket.h \ > + unix_server_socket.h \ > + unix_socket.h > > noinst_LTLIBRARIES = libbase.la > > @@ -39,4 +44,8 @@ libbase_la_LDFLAGS = -static > > libbase_la_SOURCES = \ > getenv.cc \ > - process.cc > + log_message.cc \ > + process.cc \ > + unix_client_socket.cc \ > + unix_server_socket.cc \ > + unix_socket.cc > diff --git a/osaf/libs/core/cplusplus/base/buffer.h > b/osaf/libs/core/cplusplus/base/buffer.h > new file mode 100644 > --- /dev/null > +++ b/osaf/libs/core/cplusplus/base/buffer.h > @@ -0,0 +1,100 @@ > +/* -*- OpenSAF -*- > + * > + * (C) Copyright 2016 The OpenSAF Foundation > + * > + * This program is distributed in the hope that it will be useful, but > + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY > + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed > + * under the GNU Lesser General Public License Version 2.1, February 1999. > + * The complete license can be accessed from the following location: > + * http://opensource.org/licenses/lgpl-license.php > + * See the Copying file included with the OpenSAF distribution for full > + * licensing terms. > + * > + * Author(s): Ericsson AB > + * > + */ > + > +#ifndef OSAF_LIBS_CORE_CPLUSPLUS_BASE_BUFFER_H_ > +#define OSAF_LIBS_CORE_CPLUSPLUS_BASE_BUFFER_H_ > + > +#include > +#include > +#include > +#include "osaf/libs/core/cplusplus/base/macros.h" > + > +namespace base { > + > +// An output buffer that can be used to build e.g. a message to be sent over > a > +// network. > +class Buffer { > + public: > + // Allocate a buffer with enough space to store @a capacity bytes of data. > + explicit Buffer(size_t capacity) : > + buffer_{new char[capacity]}, > + capacity_{capacity}, > + size_{0} { > + } > + ~Buffer() { > +delete [] buffer_; > + } > + // Reset the write position to the start of the buffer. > + void clear() { size_ = 0; } > + // Returns true if the buffer is empty. > + bool empty() const { return size_ == 0; } > + // Returns a pointer to the start of the buffer. > + const char* data() const { return buffer_; } > + // Returns a pointer to the end of the buffer where new data can be > appended. > + char* end() const { return buffer_ + size_; } > + // Returns the number of bytes that have been written to the buffer. > + size_t size() const { return size_; } > + // Set new size of the buffer (e.g. after manually adding data at the end). > + void set_size(size_t s) { size_ = s; } > + // Returns the maximum number of bytes that can be stored in this buffer. > + size_t capacity() const { return capacity_; } > + // Append a single character to the end of the buffer. > + void AppendChar(char c) { > +if (size_ != capacity_) buffer_[size_++] = c; > + } > + // This function is similar to AppendNumber(), except that leading zeros > will > + // be printed - i.e. this method implements a fixed field width. > + void AppendFixedWidthNumber(uint32_t number, uint32_t power) { > +for (;;) { > + uint32_t digit = number / power; > + AppendChar(digit + '0'); > + if (power == 1) break; > + number -= digit * power; > + power /= 10; > +} > + } > + // Append decimal @a number to the end of the buffer. The @a power > parameter > + // must be a power of ten, pointing to the highest possible digit in the > + // decimal number. E.g.
Re: [devel] [PATCH 1 of 1] base: Add timer tool to osaf_time and base/time [#2090]
Ack. Regards, Ramesh. On 10/7/2016 1:17 PM, Lennart Lund wrote: > osaf/libs/core/common/include/osaf_time.h | 51 > osaf/libs/core/common/tests/Makefile.am |1 + > osaf/libs/core/common/tests/osaf_millis_timeout_test.cc | 170 > > osaf/libs/core/cplusplus/base/time.h| 35 +++ > 4 files changed, 257 insertions(+), 0 deletions(-) > > > Create functions primary for handling timeout of loops and add to > osaf_time. C++ wrapper class is added to time.h in cplusplus/base > > diff --git a/osaf/libs/core/common/include/osaf_time.h > b/osaf/libs/core/common/include/osaf_time.h > --- a/osaf/libs/core/common/include/osaf_time.h > +++ b/osaf/libs/core/common/include/osaf_time.h > @@ -35,6 +35,7 @@ > #include > #include > #include > +#include > #include "osaf_utility.h" > > #ifdef __cplusplus > @@ -252,6 +253,23 @@ static inline uint64_t osaf_timespec_to_ >*/ > static inline double osaf_timespec_to_double(const struct timespec* i_ts); > > +/** > + * @brief Set a time @a i_millis in the future. To be used with > + * osaf_is_timeout() > + * > + * Read current time and add @a i_millis in @a o_ts > + */ > +static inline void osaf_set_millis_timeout(uint64_t i_millis, > + struct timespec* o_ts); > +/** > + * @brief Inform if the time given in @a i_ts is passed > + * > + * Read current time and compare with the given timeout time. > + * The return value will be -1, 0 or 1, if @a timeout time not passed, > + * time equal to @a timeout time, or greater than @a timeout time, > respectively. > + */ > +static inline bool osaf_is_timeout(const struct timespec* i_ts); > + > static inline void osaf_clock_gettime(clockid_t i_clk_id, struct timespec* > o_ts) { > if (clock_gettime(i_clk_id, o_ts) != 0) osaf_abort(i_clk_id); > } > @@ -369,6 +387,39 @@ static inline double osaf_timespec_to_do > return i_ts->tv_sec + i_ts->tv_nsec / (double) kNanosPerSec; > } > > +static inline void osaf_set_millis_timeout(uint64_t i_millis, > + struct timespec* o_ts) { > + struct timespec current_ts; > + struct timespec millis_to_add_ts; > + osaf_clock_gettime(CLOCK_MONOTONIC, ¤t_ts); > + osaf_millis_to_timespec(i_millis, &millis_to_add_ts); > + osaf_timespec_add(¤t_ts, &millis_to_add_ts, o_ts); > +} > + > +static inline bool osaf_is_timeout(const struct timespec* i_ts) { > + struct timespec current_ts; > + osaf_clock_gettime(CLOCK_MONOTONIC, ¤t_ts); > + if (osaf_timespec_compare(¤t_ts, i_ts) < 0) > +return false; > + else > +return true; > +} > + > +static inline uint64_t osaf_timeout_time_left(const struct timespec* i_ts) { > + struct timespec current_ts; > + uint64_t time_left = 0; > + struct timespec diff_ts; > + osaf_clock_gettime(CLOCK_MONOTONIC, ¤t_ts); > + if (osaf_timespec_compare(¤t_ts, i_ts) < 0) { > +osaf_timespec_subtract(i_ts, ¤t_ts, &diff_ts); > +time_left = osaf_timespec_to_millis(&diff_ts); > + } else { > +time_left = 0; > + } > + > + return time_left; > +} > + > #ifdef __cplusplus > } > #endif > diff --git a/osaf/libs/core/common/tests/Makefile.am > b/osaf/libs/core/common/tests/Makefile.am > --- a/osaf/libs/core/common/tests/Makefile.am > +++ b/osaf/libs/core/common/tests/Makefile.am > @@ -42,6 +42,7 @@ core_common_test_SOURCES = \ > osaf_timespec_compare_test.cc \ > osaf_timespec_convert_test.cc \ > osaf_timespec_subtract_test.cc \ > + osaf_millis_timeout_test.cc \ > mock_clock_gettime.cc \ > mock_clock_nanosleep.cc \ > mock_syslog.cc > diff --git a/osaf/libs/core/common/tests/osaf_millis_timeout_test.cc > b/osaf/libs/core/common/tests/osaf_millis_timeout_test.cc > new file mode 100644 > --- /dev/null > +++ b/osaf/libs/core/common/tests/osaf_millis_timeout_test.cc > @@ -0,0 +1,170 @@ > +/* -*- OpenSAF -*- > + * > + * (C) Copyright 2016 The OpenSAF Foundation > + * > + * This program is distributed in the hope that it will be useful, but > + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY > + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed > + * under the GNU Lesser General Public License Version 2.1, February 1999. > + * The complete license can be accessed from the following location: > + * http://opensource.org/licenses/lgpl-license.php > + * See the Copying file included with the OpenSAF distribution for full > + * licensing terms. > + * > + * Author(s): Ericsson AB > + * > + */ > + > +#include "osaf_time.h" > +#include "gtest/gtest.h" > +#include "mock_clock_gettime.h" > + > +time_t sec = 1000; > +long nsec = 1000; > +struct timespec ts_expresult = {0, 0}; > + > +void setupTest(uint64_t timeout_ms) { > + realtime_clock = { 0, 0 }; > + monotonic_clock = { sec, nsec }; > + mock_clock_gettime.return_value = 0; > + > + struct timespec ts_add = {0, 0}; > + osaf_millis_t
Re: [devel] [PATCH 0 of 3] Review Request for dtm: Use inotify to improve response time for transport monitor process V4 [#2091]
Hi Hans, Just FYI, I will be reviewing these V4 patches and shall provide my review comments next week. Thanks and Regards, Ramesh. On 10/27/2016 8:55 PM, Hans Nordeback wrote: > Summary: dtm: Use inotify to improve response time for transport monitor > process V4 > Review request for Trac Ticket(s): #2091 > Peer Reviewer(s): Ramesh, Mahesh, AndersW > Pull request to: > Affected branch(es): default > Development branch: default > > > Impacted area Impact y/n > > Docsn > Build systemn > RPM/packaging n > Configuration files n > Startup scripts n > SAF servicesn > OpenSAF servicesn > Core libraries y > Samples n > Tests n > Other n > > > Comments (indicate scope for each "y" above): > - > <> > > changeset 99fc59b0f23dcbc64ee5ff0c0f7fe0152b9ab618 > Author: Hans Nordeback > Date: Thu, 27 Oct 2016 17:10:30 +0200 > > base: Use inotify to improve response time for transport monitor > process V4 > [#2091] > > changeset d7288bd653de706f0ba9b5879d6093062494514a > Author: Hans Nordeback > Date: Thu, 27 Oct 2016 17:12:35 +0200 > > base: Unit tests for FileNotify V4 [#2091] > > changeset 25b06177fa8d6f5df6209c636321cece10a0784e > Author: Hans Nordeback > Date: Thu, 27 Oct 2016 17:13:46 +0200 > > dtm: Use inotify to improve response time for transport monitor process > V4 > [#2091] > > > Added Files: > > osaf/libs/core/cplusplus/base/file_notify.cc > osaf/libs/core/cplusplus/base/file_notify.h > osaf/libs/core/cplusplus/base/tests/file_notify_test.cc > > > Complete diffstat: > -- > osaf/libs/core/cplusplus/base/Makefile.am |2 + > osaf/libs/core/cplusplus/base/file_notify.cc| 190 > + > osaf/libs/core/cplusplus/base/file_notify.h | 102 > ++ > osaf/libs/core/cplusplus/base/tests/Makefile.am |7 +- > osaf/libs/core/cplusplus/base/tests/file_notify_test.cc | 83 > + > 5 files changed, 382 insertions(+), 2 deletions(-) > > > Testing Commands: > - > <> > > > Testing, Expected Results: > -- > <> > > > Conditions of Submission: > - > <> > > > Arch Built StartedLinux distro > --- > mipsn n > mips64 n n > x86 n n > x86_64 n n > powerpc n n > powerpc64 n n > > > Reviewer Checklist: > --- > [Submitters: make sure that your review doesn't trigger any checkmarks!] > > > Your checkin has not passed review because (see checked entries): > > ___ Your RR template is generally incomplete; it has too many blank entries > that need proper data filled in. > > ___ You have failed to nominate the proper persons for review and push. > > ___ Your patches do not have proper short+long header > > ___ You have grammar/spelling in your header that is unacceptable. > > ___ You have exceeded a sensible line length in your headers/comments/text. > > ___ You have failed to put in a proper Trac Ticket # into your commits. > > ___ You have incorrectly put/left internal data in your comments/files > (i.e. internal bug tracking tool IDs, product names etc) > > ___ You have not given any evidence of testing beyond basic build tests. > Demonstrate some level of runtime or other sanity testing. > > ___ You have ^M present in some of your files. These have to be removed. > > ___ You have needlessly changed whitespace or added whitespace crimes > like trailing spaces, or spaces before tabs. > > ___ You have mixed real technical changes with whitespace and other > cosmetic code cleanup changes. These have to be separate commits. > > ___ You need to refactor your submission into logical chunks; there is > too much content into a single commit. > > ___ You have extraneous garbage in your review (merge commits etc) > > ___ You have giant attachments which should never have been sent; > Instead you should place your content in a public tree to be pulled. > > ___ You have too many commits attached to an e-mail; resend as threaded > commits, or place in a public tree for a pull. > > ___ You have resent this content multiple times without a clear indication > of what has changed between each re-send. > > ___ You have failed to adequately and individually address all of the > comments and change requests that were proposed in the initial review. > > ___ You have a misconfigured ~/.hgrc file (i.e. username, email etc) > > ___ Your computer have a badly configured date and time; conf
Re: [devel] [PATCH 1 of 3] base: Use inotify to improve response time for transport monitor process V4 [#2091]
Ack with very minor comments inline. Regards, Ramesh. On 10/27/2016 8:55 PM, Hans Nordeback wrote: > osaf/libs/core/cplusplus/base/Makefile.am|2 + > osaf/libs/core/cplusplus/base/file_notify.cc | 190 > +++ > osaf/libs/core/cplusplus/base/file_notify.h | 102 ++ > 3 files changed, 294 insertions(+), 0 deletions(-) > > > diff --git a/osaf/libs/core/cplusplus/base/Makefile.am > b/osaf/libs/core/cplusplus/base/Makefile.am > --- a/osaf/libs/core/cplusplus/base/Makefile.am > +++ b/osaf/libs/core/cplusplus/base/Makefile.am > @@ -24,6 +24,7 @@ SUBDIRS = tests > > noinst_HEADERS = \ > buffer.h \ > + file_notify.h \ > getenv.h \ > log_message.h \ > macros.h \ > @@ -43,6 +44,7 @@ libbase_la_CPPFLAGS = \ > libbase_la_LDFLAGS = -static > > libbase_la_SOURCES = \ > + file_notify.cc \ > getenv.cc \ > log_message.cc \ > process.cc \ > diff --git a/osaf/libs/core/cplusplus/base/file_notify.cc > b/osaf/libs/core/cplusplus/base/file_notify.cc > new file mode 100644 > --- /dev/null > +++ b/osaf/libs/core/cplusplus/base/file_notify.cc > @@ -0,0 +1,190 @@ > +/* -*- OpenSAF -*- > + * > + * (C) Copyright 2016 The OpenSAF Foundation > + * > + * This program is distributed in the hope that it will be useful, but > + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY > + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed > + * under the GNU Lesser General Public License Version 2.1, February 1999. > + * The complete license can be accessed from the following location: > + * http://opensource.org/licenses/lgpl-license.php > + * See the Copying file included with the OpenSAF distribution for full > + * licensing terms. > + * > + * Author(s): Ericsson AB > + * > + */ > + > +#include "base/file_notify.h" > +#include > +#include > +#include > +#include > +#include "time.h" > +#include "osaf_poll.h" > +#include "logtrace.h" > + > +namespace base { > + > +FileNotify::FileNotify() { > + if ((inotify_fd_ = inotify_init()) == -1) { > +LOG_NO("inotify_init failed: %s", strerror(errno)); > + } > +} > + > +FileNotify::~FileNotify() { > + close(inotify_fd_); > +} > + > +void FileNotify::SplitFileName(const std::string &file_name) { > + char *tmp1 = strdup(file_name.c_str()); > + char *tmp2 = strdup(file_name.c_str()); > + file_path_ = dirname(tmp1); > + file_name_ = basename(tmp2); > + free(tmp1); > + free(tmp2); > +} > + > +FileNotify::FileNotifyErrors > +FileNotify::WaitForFileCreation(const std::string &file_name, > +const std::vector& user_fds, int > timeout) { > + FileNotify::FileNotifyErrors rc {FileNotifyErrors::kOK}; > + SplitFileName(file_name); > + > + if ((inotify_wd_ = > + inotify_add_watch(inotify_fd_, file_path_.c_str(), IN_CREATE)) == -1) > { > +LOG_NO("inotify_add_watch failed: %s", strerror(errno)); > +return FileNotifyErrors::kError; > + } > + > + if (FileExists(file_name)) { > +TRACE("File already created: %s", file_name.c_str()); > +inotify_rm_watch(inotify_fd_, inotify_wd_); > +return FileNotifyErrors::kOK; > + } [Ramesh]: How about checking FileExists() first i.e., before adding to watch. > + > + rc = ProcessEvents(user_fds, timeout); > + inotify_rm_watch(inotify_fd_, inotify_wd_); > + return rc; > +} > + > +FileNotify::FileNotifyErrors > +FileNotify::WaitForFileDeletion(const std::string &file_name, > +const std::vector& user_fds, > +int timeout) { > + FileNotify::FileNotifyErrors rc {FileNotifyErrors::kOK}; > + > + if ((inotify_wd_ = inotify_add_watch(inotify_fd_, file_name.c_str(), > + IN_DELETE_SELF)) == -1) { > +if (errno == ENOENT) { > + TRACE("File already deleted: %s", file_name.c_str()); > + return FileNotifyErrors::kOK; > +} else { > + LOG_NO("inotify_add_watch failed: %s", strerror(errno)); > + return FileNotifyErrors::kError; > +} > + } > + > + rc = ProcessEvents(user_fds, timeout); > + inotify_rm_watch(inotify_fd_, inotify_wd_); > + return rc; > +} > + > +FileNotify::FileNotifyErrors > +FileNotify::ProcessEvents(const std::vector& user_fds, int timeout) { > + enum { > +FD_INOTIFY = 0, > + }; > + > + timespec start_time {0}; > + timespec time_left_ts {0}; > + timespec timeout_ts {0}; > + > + int num_of_fds = user_fds.size() + 1; > + pollfd* fds = new pollfd[num_of_fds]; > + > + fds[FD_INOTIFY].fd = inotify_fd_; > + fds[FD_INOTIFY].events = POLLIN; > + for (int i = 1; i < num_of_fds; ++i) { > +fds[i].fd = user_fds[i - 1]; > +fds[i].events = POLLIN; > + } > + > + timeout_ts = base::MillisToTimespec(timeout); > + start_time = base::ReadMonotonicClock(); > + > + while (true) { > +TRACE("remaining timeout: %d", timeout); > +unsigned rc = osaf_poll(fds, num_of_fds, timeout); > + > +if (
Re: [devel] [PATCH 2 of 3] base: Unit tests for FileNotify V4 [#2091]
Ack. Thanks, Ramesh. On 10/27/2016 8:55 PM, Hans Nordeback wrote: > osaf/libs/core/cplusplus/base/tests/Makefile.am | 7 +- > osaf/libs/core/cplusplus/base/tests/file_notify_test.cc | 83 > + > 2 files changed, 88 insertions(+), 2 deletions(-) > > > diff --git a/osaf/libs/core/cplusplus/base/tests/Makefile.am > b/osaf/libs/core/cplusplus/base/tests/Makefile.am > --- a/osaf/libs/core/cplusplus/base/tests/Makefile.am > +++ b/osaf/libs/core/cplusplus/base/tests/Makefile.am > @@ -33,7 +33,8 @@ libbase_test_LDFLAGS = \ > -pthread -lrt \ > $(top_builddir)/osaf/libs/core/cplusplus/base/libbase_la-getenv.o \ > $(top_builddir)/osaf/libs/core/cplusplus/base/libbase_la-log_message.o \ > - $(top_builddir)/osaf/libs/core/cplusplus/base/libbase_la-process.o > + $(top_builddir)/osaf/libs/core/cplusplus/base/libbase_la-process.o \ > + $(top_builddir)/osaf/libs/core/cplusplus/base/libbase_la-file_notify.o > > libbase_test_SOURCES = \ > getenv_test.cc \ > @@ -44,8 +45,10 @@ libbase_test_SOURCES = \ > time_add_test.cc \ > time_compare_test.cc \ > time_convert_test.cc \ > + file_notify_test.cc \ > time_subtract_test.cc > > libbase_test_LDADD = \ > $(GTEST_DIR)/lib/libgtest.la \ > - $(GTEST_DIR)/lib/libgtest_main.la > + $(GTEST_DIR)/lib/libgtest_main.la \ > + $(top_builddir)/osaf/libs/core/libopensaf_core.la > diff --git a/osaf/libs/core/cplusplus/base/tests/file_notify_test.cc > b/osaf/libs/core/cplusplus/base/tests/file_notify_test.cc > new file mode 100644 > --- /dev/null > +++ b/osaf/libs/core/cplusplus/base/tests/file_notify_test.cc > @@ -0,0 +1,83 @@ > +/* -*- OpenSAF -*- > + * > + * (C) Copyright 2016 The OpenSAF Foundation > + * > + * This program is distributed in the hope that it will be useful, but > + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY > + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed > + * under the GNU Lesser General Public License Version 2.1, February 1999. > + * The complete license can be accessed from the following location: > + * http://opensource.org/licenses/lgpl-license.php > + * See the Copying file included with the OpenSAF distribution for full > + * licensing terms. > + * > + * Author(s): Ericsson AB > + * > + */ > + > +#include "base/file_notify.h" > +#include "gtest/gtest.h" > + > +class FileNotifyTest : public ::testing::Test { > + protected: > + FileNotifyTest() { > +// Setup work can be done here for each test. > + } > + > + virtual ~FileNotifyTest() { > +// Cleanup work that doesn't throw exceptions here. > + } > + > + // If the constructor and destructor are not enough for setting up > + // and cleaning up each test, you can define the following methods: > + > + // cppcheck-suppress unusedFunction > + virtual void SetUp() { > +// Code here will be called immediately after the constructor (right > +// before each test). > + } > + > + // cppcheck-suppress unusedFunction > + virtual void TearDown() { > +// Code here will be called immediately after each test (right > +// before the destructor). > + } > + > + // Objects declared here can be used by all tests in the test case. > + base::FileNotify::FileNotifyErrors > rc{base::FileNotify::FileNotifyErrors::kOK}; > +}; > + > +// > +TEST_F(FileNotifyTest, TestNonExistingPathCreation) { > + base::FileNotify file_notify; > + std::string non_existing_file = "/a/b/c"; > + > + rc = file_notify.WaitForFileCreation(non_existing_file, 10); > + ASSERT_EQ(rc, base::FileNotify::FileNotifyErrors::kError); > +} > + > +// > +TEST_F(FileNotifyTest, TestExistingFileCreation) { > + base::FileNotify file_notify; > + std::string existing_file = __FILE__; > + > + rc = file_notify.WaitForFileCreation(existing_file, 10); > + ASSERT_EQ(rc, base::FileNotify::FileNotifyErrors::kOK); > +} > + > +// > +TEST_F(FileNotifyTest, TestNonExistingPathDeletion) { > + base::FileNotify file_notify; > + std::string non_existing_path = "/a/b/c"; > + > + rc = file_notify.WaitForFileDeletion(non_existing_path, 10); > + ASSERT_EQ(rc, base::FileNotify::FileNotifyErrors::kOK); > +} > + > +TEST_F(FileNotifyTest, TestExistingFileDeletion) { > + base::FileNotify file_notify; > + std::string existing_file = __FILE__; > + > + rc = file_notify.WaitForFileDeletion(existing_file, 10); > + ASSERT_EQ(rc, base::FileNotify::FileNotifyErrors::kTimeOut); > +} -- Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 2] base: Add Mutex, Lock and ConditionVariable classes [#2173]
Ack. Thanks, Ramesh. On 11/8/2016 8:50 PM, Anders Widell wrote: > osaf/libs/core/cplusplus/base/Makefile.am | 4 + > osaf/libs/core/cplusplus/base/condition_variable.cc | 39 > osaf/libs/core/cplusplus/base/condition_variable.h | 95 > + > osaf/libs/core/cplusplus/base/mutex.cc | 46 ++ > osaf/libs/core/cplusplus/base/mutex.h | 82 ++ > 5 files changed, 266 insertions(+), 0 deletions(-) > > > Add classes for Mutex, Lock and ConditionVariable - similar to std::mutex, > std::unique_lock and std::condition_variable. One reason for adding these to > OpenSAF is that the C++ standard library casses are unapproved by the Google > C++ > Style Guide. Another reason is that we can integrate them better into OpenSAF: > we select the appropriate options when creating the mutex and condition > variable, and we call osaf_abort() in case an unexpected error is > encountered. Also, we will use an error checking mutex when the ENABLE_DEBUG > preprocessor macro is defined - paving the way for special OpenSAF debug > builds. > > diff --git a/osaf/libs/core/cplusplus/base/Makefile.am > b/osaf/libs/core/cplusplus/base/Makefile.am > --- a/osaf/libs/core/cplusplus/base/Makefile.am > +++ b/osaf/libs/core/cplusplus/base/Makefile.am > @@ -28,6 +28,8 @@ noinst_HEADERS = \ > getenv.h \ > log_message.h \ > macros.h \ > + mutex.h \ > + condition_variable.h \ > process.h \ > time.h \ > unix_client_socket.h \ > @@ -48,6 +50,8 @@ libbase_la_SOURCES = \ > getenv.cc \ > log_message.cc \ > process.cc \ > + mutex.cc \ > + condition_variable.cc \ > unix_client_socket.cc \ > unix_server_socket.cc \ > unix_socket.cc > diff --git a/osaf/libs/core/cplusplus/base/condition_variable.cc > b/osaf/libs/core/cplusplus/base/condition_variable.cc > new file mode 100644 > --- /dev/null > +++ b/osaf/libs/core/cplusplus/base/condition_variable.cc > @@ -0,0 +1,39 @@ > +/* -*- OpenSAF -*- > + * > + * (C) Copyright 2016 The OpenSAF Foundation > + * > + * This program is distributed in the hope that it will be useful, but > + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY > + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed > + * under the GNU Lesser General Public License Version 2.1, February 1999. > + * The complete license can be accessed from the following location: > + * http://opensource.org/licenses/lgpl-license.php > + * See the Copying file included with the OpenSAF distribution for full > + * licensing terms. > + * > + * Author(s): Ericsson AB > + * > + */ > + > +#include "osaf/libs/core/cplusplus/base/condition_variable.h" > + > +namespace base { > + > +ConditionVariable::ConditionVariable() : condition_variable_{} { > + pthread_condattr_t attr; > + int result = pthread_condattr_init(&attr); > + if (result != 0) osaf_abort(result); > + result = pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); > + if (result != 0) osaf_abort(result); > + result = pthread_cond_init(&condition_variable_, &attr); > + if (result != 0) osaf_abort(result); > + result = pthread_condattr_destroy(&attr); > + if (result != 0) osaf_abort(result); > +} > + > +ConditionVariable::~ConditionVariable() { > + int result = pthread_cond_destroy(&condition_variable_); > + if (result != 0) osaf_abort(result); > +} > + > +} // namespace base > diff --git a/osaf/libs/core/cplusplus/base/condition_variable.h > b/osaf/libs/core/cplusplus/base/condition_variable.h > new file mode 100644 > --- /dev/null > +++ b/osaf/libs/core/cplusplus/base/condition_variable.h > @@ -0,0 +1,95 @@ > +/* -*- OpenSAF -*- > + * > + * (C) Copyright 2016 The OpenSAF Foundation > + * > + * This program is distributed in the hope that it will be useful, but > + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY > + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed > + * under the GNU Lesser General Public License Version 2.1, February 1999. > + * The complete license can be accessed from the following location: > + * http://opensource.org/licenses/lgpl-license.php > + * See the Copying file included with the OpenSAF distribution for full > + * licensing terms. > + * > + * Author(s): Ericsson AB > + * > + */ > + > +#ifndef OSAF_LIBS_CORE_CPLUSPLUS_BASE_CONDITION_VARIABLE_H_ > +#define OSAF_LIBS_CORE_CPLUSPLUS_BASE_CONDITION_VARIABLE_H_ > + > +#include > +#include > +#include "osaf/libs/core/common/include/osaf_utility.h" > +#include "osaf/libs/core/cplusplus/base/macros.h" > +#include "osaf/libs/core/cplusplus/base/mutex.h" > +#include "osaf/libs/core/cplusplus/base/time.h" > + > +namespace base { > + > +enum class CvStatus { kNoTimeout, kTimeout }; > + > +// A condition variable, with an API similar to std::condition_variable. The > +// timed methods always use the monotonic clock (clock id C
Re: [devel] [PATCH 2 of 2] base: Use the Mutex and Lock classes [#2173]
Ack. Thanks, Ramesh. On 11/8/2016 8:50 PM, Anders Widell wrote: > osaf/libs/core/cplusplus/base/process.cc | 31 > --- > osaf/libs/core/cplusplus/base/process.h | 19 + > osaf/libs/core/cplusplus/base/unix_socket.cc | 17 +- > osaf/libs/core/cplusplus/base/unix_socket.h | 3 +- > 4 files changed, 32 insertions(+), 38 deletions(-) > > > Use the new Mutex and Lock classes instead of std::mutex, std::unique_lock and > pthread_mutex_t. > > diff --git a/osaf/libs/core/cplusplus/base/process.cc > b/osaf/libs/core/cplusplus/base/process.cc > --- a/osaf/libs/core/cplusplus/base/process.cc > +++ b/osaf/libs/core/cplusplus/base/process.cc > @@ -50,10 +50,12 @@ Process::~Process() { > } > > void Process::Kill(int sig_no, const Duration& wait_time) { > - std::unique_lock lock(mutex_); > - pid_t pgid = process_group_id_; > - process_group_id_ = 0; > - lock.unlock(); > + pid_t pgid; > + { > +Lock lock(mutex_); > +pgid = process_group_id_; > +process_group_id_ = 0; > + } > if (pgid > 1) KillProc(-pgid, sig_no, wait_time); > } > > @@ -119,20 +121,23 @@ void Process::Execute(int argc, char *ar > LOG_WA("setpgid(%u, 0) failed: %s", >(unsigned) child_pid, strerror(errno)); > } > -std::unique_lock lock(mutex_); > -process_group_id_ = child_pid; > -StartTimer(timeout); > -lock.unlock(); > +{ > + Lock lock(mutex_); > + process_group_id_ = child_pid; > + StartTimer(timeout); > +} > int status; > pid_t wait_pid; > do { > wait_pid = waitpid(child_pid, &status, 0); > } while (wait_pid == (pid_t) -1 && errno == EINTR); > -lock.lock(); > -StopTimer(); > -bool killed = process_group_id_ == 0; > -process_group_id_ = 0; > -lock.unlock(); > +bool killed; > +{ > + Lock lock(mutex_); > + StopTimer(); > + killed = process_group_id_ == 0; > + process_group_id_ = 0; > +} > bool successful = false; > if (!killed && wait_pid != (pid_t) -1) { > if (!WIFEXITED(status)) { > diff --git a/osaf/libs/core/cplusplus/base/process.h > b/osaf/libs/core/cplusplus/base/process.h > --- a/osaf/libs/core/cplusplus/base/process.h > +++ b/osaf/libs/core/cplusplus/base/process.h > @@ -15,20 +15,19 @@ >* >*/ > > -#ifndef OPENSAF_OSAF_LIBS_CORE_CPLUSPLUS_BASE_PROCESS_H_ > -#define OPENSAF_OSAF_LIBS_CORE_CPLUSPLUS_BASE_PROCESS_H_ > +#ifndef OSAF_LIBS_CORE_CPLUSPLUS_BASE_PROCESS_H_ > +#define OSAF_LIBS_CORE_CPLUSPLUS_BASE_PROCESS_H_ > > +#include > #include > #include > #include > -#include > -#include > -#include "base/macros.h" > +#include "osaf/libs/core/cplusplus/base/macros.h" > +#include "osaf/libs/core/cplusplus/base/mutex.h" > > namespace base { > > class Process { > - DELETE_COPY_AND_MOVE_OPERATORS(Process); >public: > using Duration = std::chrono::steady_clock::duration; > Process(); > @@ -96,18 +95,20 @@ class Process { > * processes in the process group have terminated. > */ > static void KillProc(pid_t pid, int sig_no, const Duration& wait_time); > + >private: > using Clock = std::chrono::steady_clock; > using TimePoint = std::chrono::steady_clock::time_point; > void StartTimer(const Duration& timeout); > void StopTimer(); > static void TimerExpirationEvent(sigval notification_data); > - std::mutex mutex_; > + Mutex mutex_; > timer_t timer_id_; > bool is_timer_created_; > pid_t process_group_id_; > + DELETE_COPY_AND_MOVE_OPERATORS(Process); > }; > > -} // namespace base > +} // namespace base > > -#endif /* OPENSAF_OSAF_LIBS_CORE_CPLUSPLUS_BASE_PROCESS_H_ */ > +#endif // OSAF_LIBS_CORE_CPLUSPLUS_BASE_PROCESS_H_ > diff --git a/osaf/libs/core/cplusplus/base/unix_socket.cc > b/osaf/libs/core/cplusplus/base/unix_socket.cc > --- a/osaf/libs/core/cplusplus/base/unix_socket.cc > +++ b/osaf/libs/core/cplusplus/base/unix_socket.cc > @@ -32,19 +32,10 @@ UnixSocket::UnixSocket(const std::string > } else { > addr_.sun_path[0] = '\0'; > } > - pthread_mutexattr_t attr; > - int result = pthread_mutexattr_init(&attr); > - if (result != 0) osaf_abort(result); > - result = pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT); > - if (result != 0) osaf_abort(result); > - result = pthread_mutex_init(&mutex_, &attr); > - if (result != 0) osaf_abort(result); > - result = pthread_mutexattr_destroy(&attr); > - if (result != 0) osaf_abort(result); > } > > int UnixSocket::Open() { > - osaf_mutex_lock_ordie(&mutex_); > + Lock lock(mutex_); > int sock = fd_; > if (sock < 0) { > if (addr_.sun_path[0] != '\0') { > @@ -60,18 +51,15 @@ int UnixSocket::Open() { > errno = ENAMETOOLONG; > } > } > - osaf_mutex_unlock_ordie(&mutex_); > return sock; > } > > UnixSocket::~UnixSocket() { > Close(); > - int result = p
Re: [devel] [PATCH 1 of 1] cpnd: ensure shared memory size before writing [#2202]
Hi, I am clueless how this patch is resolving this issue i.e., by checking through fstat(_fd) and comparing the sizes etc. It suppose to check the available space of /dev/shm (tmpfs) just before a write() operation like.., // /* Check File System available space */// /char shm_dir[]="/dev/shm";// struct statvfs info; i//f (statvfs(shm_dir, &info) == 0)/ and get available space by calculating "/info.f_bfree*info.f_bsize/" etc. Also make sure to do this check before every write in cpnd. If my interpretation is not correct, would like to understand more on the context of the issue. Thanks and Regards, Ramesh. On 11/28/2016 11:17 AM, A V Mahesh wrote: > Hi Hoang, > > Ok let us only focus on core dump , so solution should be, adding > section to checkpoint will still fail and let us change LOG to > possible error case of SHM deficiency and return error to CPA . > > Cpnd will NOT check the true size of shared memory for each write call > before writing, this will degrade the performance of CPSV. > > Can you please re-send the patch V2 with fulfilling above , and change > the fix description as well. > > -AVM > > On 11/25/2016 4:21 PM, Anders Widell wrote: >> Yes, the problem with setting OSAF_CKPT_SHM_ALLOC_GUARANTEE is that >> the memory consumption will increase. Therefore it is not backwards >> compatible and thus not possible to do as a bug-fix. >> >> regards, >> >> Anders Widell >> >> >> On 11/25/2016 10:46 AM, Vo Minh Hoang wrote: >>> Dear Mahesh, >>> >>> I think this problem is #1712, problem occur when >>> OSAF_CKPT_SHM_ALLOC_GUARANTEE is not set. >>> >>> My thinking is that because we provide 2 mode (guarantee or not) so we >>> should making sure no coredump happened. >>> Btw, because this is out of my scope of decide, I would like to ask >>> Anders >>> Widell about it. >>> >>> -Original Message- >>> From: A V Mahesh [mailto:mahesh.va...@oracle.com] >>> Sent: Friday, November 25, 2016 4:06 PM >>> To: Hoang Vo ; anders.wid...@ericsson.com >>> Cc: opensaf-devel@lists.sourceforge.net >>> Subject: Re: [PATCH 1 of 1] cpnd: ensure shared memory size before >>> writing >>> [#2202] >>> >>> Hi Hoang, >>> >>> Is this issue coming with enabling #1712 feature ? >>> >>> Exporting `OSAF_CKPT_SHM_ALLOC_GUARANTEE=1` will provide >>> guaranteed CPSV >>> service SHM issue and this is addressed broadly all SHM memory issue. >>> >>> So I don't think we required API level changes. ( may we need to >>> document >>> the usage of Exporting `OSAF_CKPT_SHM_ALLOC_GUARANTEE=1` ) >>> >>> #1712 description >>> >>> >>> == >>> summary: leap: provide ensured disk space option for shm_open >>> request [1712] >>> >>> description: >>> leap: provide ensured disk space option for shm_open request [1712] >>> Provided >>> ensured disk space is allocated for NCS_OS_POSIX_SHM_REQ_OPEN request >>> using >>> posix_fallocate() so that application such as CPSV subsequent writes to >>> bytes in the specified range are guaranteed not to fail because of >>> lack of >>> disk space. >>> >>> Updated the Opensaf services according to new options based on >>> requirements. >>> >>> Cpsv service uses the ensured disk space option based on >>> OSAF_CKPT_SHM_ALLOC_GUARANTEE environment variable ,so if user >>> exports as >>> OSAF_CKPT_SHM_ALLOC_GUARANTEE=1 (true) cpsv provided ensured disk space. >>> >>> >>> == >>> >>> -AVM >>> >>> >>> On 11/23/2016 3:28 PM, Hoang Vo wrote: osaf/libs/core/include/ncs_osprm.h | 9 + osaf/libs/core/leap/os_defs.c | 19 +-- osaf/services/saf/cpsv/cpnd/cpnd_proc.c | 16 3 files changed, 42 insertions(+), 2 deletions(-) problem: when checkpoint service init without shared memory size guaranteed works in high memory load, core dump occur while adding section >>> to checkpoint. solution: check the true size of shared memory before writing to it. diff --git a/osaf/libs/core/include/ncs_osprm.h b/osaf/libs/core/include/ncs_osprm.h --- a/osaf/libs/core/include/ncs_osprm.h +++ b/osaf/libs/core/include/ncs_osprm.h @@ -557,6 +557,7 @@ typedef enum { NCS_OS_POSIX_SHM_REQ_UNLINK,/* unlink is shm_unlink */ NCS_OS_POSIX_SHM_REQ_READ, NCS_OS_POSIX_SHM_REQ_WRITE, + NCS_OS_POSIX_SHM_REQ_STATS, NCS_OS_POSIX_SHM_REQ_MAX } NCS_OS_POSIX_SHM_REQ_TYPE; typedef struct ncs_os_posix_shm_req_open_info_tag { @@ -598,6 +599,13 @@ typedef struct ncs_os_posix_shm_req_writ uint64_t i_offset; } NCS_OS_POSIX_SHM_REQ_WRITE_INFO; +typedef struct ncs_os_posix_shm_req_stats_info_tag { + uint32_t i_hdl; + int32_t i_fd; + bool ensures_space; + void *o_addr; +} NCS_OS_PO
Re: [devel] [PATCH 1 of 3] leap : now leap library ensure shm availability before writing [#2202]
Hi Mahesh, Please see my comments with [Ramesh] inline. Thanks, Ramesh. On 11/29/2016 4:07 PM, mahesh.va...@oracle.com wrote: > osaf/libs/core/leap/os_defs.c | 20 ++-- > 1 files changed, 18 insertions(+), 2 deletions(-) > > > Issue : > > If OSAF_CKPT_SHM_ALLOC_GUARANTEE is NOT set and SHM is 100% used in system , > pnd Segmentation fault (core dumped) at LEAP memcpy(). > > Fix : > > Now LEAP library ensures shm free space before writing > This may degrade some performance of cpsv , if OSAF_CKPT_SHM_ALLOC_GUARANTEE > is set, > cpsv give natural performance. > > diff --git a/osaf/libs/core/leap/os_defs.c b/osaf/libs/core/leap/os_defs.c > --- a/osaf/libs/core/leap/os_defs.c > +++ b/osaf/libs/core/leap/os_defs.c > @@ -38,6 +38,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -771,6 +772,7 @@ uint32_t ncs_os_posix_shm(NCS_OS_POSIX_S > int32_t ret_flag; > uint64_t shm_size; > char shm_name[PATH_MAX]; > + struct statvfs statsvfs; > > switch (req->type) { > case NCS_OS_POSIX_SHM_REQ_OPEN: /* opens and mmaps */ > @@ -792,7 +794,7 @@ uint32_t ncs_os_posix_shm(NCS_OS_POSIX_S > if (req->info.open.o_fd < 0) { > return NCSCC_RC_FAILURE; > } else { > - if (req->info.open.ensures_space == true) { > + if (req->ensures_space == true) { > if (posix_fallocate(req->info.open.o_fd, 0, > shm_size) != 0) { > LOG_ER("posix_shm:posix_fallocate > failed() with errno: %d \n", errno); > return NCSCC_RC_FAILURE; > @@ -855,8 +857,22 @@ uint32_t ncs_os_posix_shm(NCS_OS_POSIX_S > break; > > case NCS_OS_POSIX_SHM_REQ_WRITE: > + if (req->ensures_space == false) { > + /* Check for the available shared memory space */ [Ramesh]: Probably better to define an environment variable for /dev/shm, to accommodate user defined disk space path etc. Can fix this later too. > + if (statvfs("/dev/shm", &statsvfs) != 0) { > + syslog(LOG_ERR, "statvfs failed to get file > system statistics with errno value %d\n", errno); > + return NCSCC_RC_FAILURE; > + } > + > + /* Checking whether sufficient shared memory is > available to write the data, to be safer side ffree reduced to 1 block size */ [Ramesh]: As per the above comment, please do (statvfs.f_bfree-1)*statsvfs.f_frsize. > + if (req->info.write.i_write_size > (statsvfs.f_bfree * > statsvfs.f_frsize)) { > + syslog(LOG_ERR, "Insufficient shared memory > space (%ld) available to write the data of size: %ld \n", > + (statsvfs.f_bfree * > statsvfs.f_frsize), req->info.write.i_write_size); > + return NCSCC_RC_FAILURE; > + } > + } > memcpy((void *)((char *)req->info.write.i_addr + > req->info.write.i_offset), req->info.write.i_from_buff, > -req->info.write.i_write_size); > + req->info.write.i_write_size); > break; > > default: -- ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 3 of 3] mqsv : update mqsv error handing based on leap changes [#2202]
Ack. Thanks, Ramesh. On 11/29/2016 4:07 PM, mahesh.va...@oracle.com wrote: > osaf/services/saf/glsv/glnd/glnd_shm.c | 2 +- > osaf/services/saf/mqsv/mqnd/mqnd_shm.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > > diff --git a/osaf/services/saf/glsv/glnd/glnd_shm.c > b/osaf/services/saf/glsv/glnd/glnd_shm.c > --- a/osaf/services/saf/glsv/glnd/glnd_shm.c > +++ b/osaf/services/saf/glsv/glnd/glnd_shm.c > @@ -71,7 +71,7 @@ static uint32_t glnd_shm_open(GLND_CB *c > > glnd_open_req.type = NCS_OS_POSIX_SHM_REQ_OPEN; > glnd_open_req.info.open.i_size = shm_size; > - glnd_open_req.info.open.ensures_space = false; > + glnd_open_req.ensures_space = false; > glnd_open_req.info.open.i_offset = 0; > glnd_open_req.info.open.i_name = shm_name; > glnd_open_req.info.open.i_map_flags = MAP_SHARED; > diff --git a/osaf/services/saf/mqsv/mqnd/mqnd_shm.c > b/osaf/services/saf/mqsv/mqnd/mqnd_shm.c > --- a/osaf/services/saf/mqsv/mqnd/mqnd_shm.c > +++ b/osaf/services/saf/mqsv/mqnd/mqnd_shm.c > @@ -66,7 +66,7 @@ uint32_t mqnd_shm_create(MQND_CB *cb) > mqnd_open_req.type = NCS_OS_POSIX_SHM_REQ_OPEN; > mqnd_open_req.info.open.i_size = > sizeof(MQND_SHM_VERSION) + (sizeof(MQND_QUEUE_CKPT_INFO) * > cb->mqnd_shm.max_open_queues); > - mqnd_open_req.info.open.ensures_space = false; > + mqnd_open_req.ensures_space = false; > mqnd_open_req.info.open.i_offset = 0; > mqnd_open_req.info.open.i_name = shm_name; > mqnd_open_req.info.open.i_map_flags = MAP_SHARED; -- ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 3] leap : now leap library ensure shm availability before writing [#2202]
Forgot to mention my Ack along with review comments. Thanks, Ramesh. On 11/30/2016 11:23 AM, ramesh betham wrote: > Hi Mahesh, > > Please see my comments with [Ramesh] inline. > > Thanks, > Ramesh. > > On 11/29/2016 4:07 PM, mahesh.va...@oracle.com wrote: >> osaf/libs/core/leap/os_defs.c | 20 ++-- >> 1 files changed, 18 insertions(+), 2 deletions(-) >> >> >> Issue : >> >> If OSAF_CKPT_SHM_ALLOC_GUARANTEE is NOT set and SHM is 100% used in system , >> pnd Segmentation fault (core dumped) at LEAP memcpy(). >> >> Fix : >> >> Now LEAP library ensures shm free space before writing >> This may degrade some performance of cpsv , if >> OSAF_CKPT_SHM_ALLOC_GUARANTEE is set, >> cpsv give natural performance. >> >> diff --git a/osaf/libs/core/leap/os_defs.c b/osaf/libs/core/leap/os_defs.c >> --- a/osaf/libs/core/leap/os_defs.c >> +++ b/osaf/libs/core/leap/os_defs.c >> @@ -38,6 +38,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -771,6 +772,7 @@ uint32_t ncs_os_posix_shm(NCS_OS_POSIX_S >> int32_t ret_flag; >> uint64_t shm_size; >> char shm_name[PATH_MAX]; >> +struct statvfs statsvfs; >> >> switch (req->type) { >> case NCS_OS_POSIX_SHM_REQ_OPEN: /* opens and mmaps */ >> @@ -792,7 +794,7 @@ uint32_t ncs_os_posix_shm(NCS_OS_POSIX_S >> if (req->info.open.o_fd < 0) { >> return NCSCC_RC_FAILURE; >> } else { >> -if (req->info.open.ensures_space == true) { >> +if (req->ensures_space == true) { >> if (posix_fallocate(req->info.open.o_fd, 0, >> shm_size) != 0) { >> LOG_ER("posix_shm:posix_fallocate >> failed() with errno: %d \n", errno); >> return NCSCC_RC_FAILURE; >> @@ -855,8 +857,22 @@ uint32_t ncs_os_posix_shm(NCS_OS_POSIX_S >> break; >> >> case NCS_OS_POSIX_SHM_REQ_WRITE: >> +if (req->ensures_space == false) { >> +/* Check for the available shared memory space */ > [Ramesh]: Probably better to define an environment variable for > /dev/shm, to accommodate user defined disk space path etc. Can fix > this later too. >> +if (statvfs("/dev/shm", &statsvfs) != 0) { >> +syslog(LOG_ERR, "statvfs failed to get file >> system statistics with errno value %d\n", errno); >> +return NCSCC_RC_FAILURE; >> +} >> + >> +/* Checking whether sufficient shared memory is >> available to write the data, to be safer side ffree reduced to 1 block size >> */ > [Ramesh]: As per the above comment, please do > (statvfs.f_bfree-1)*statsvfs.f_frsize. > >> +if (req->info.write.i_write_size > (statsvfs.f_bfree * >> statsvfs.f_frsize)) { >> +syslog(LOG_ERR, "Insufficient shared memory >> space (%ld) available to write the data of size: %ld \n", >> +(statsvfs.f_bfree * >> statsvfs.f_frsize), req->info.write.i_write_size); >> +return NCSCC_RC_FAILURE; >> +} >> +} >> memcpy((void *)((char *)req->info.write.i_addr + >> req->info.write.i_offset), req->info.write.i_from_buff, >> - req->info.write.i_write_size); >> +req->info.write.i_write_size); >> break; >> >> default: > -- ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 0 of 3] Review Request for leap : now leap library ensure shm availability before writing [#2202]
Hi Hoang, Can you please provide the snapshot of "df -h /dev/shm" when the issue occurs. Also.. can you please provide the corresponding core dump file and "osafckptnd" process file (process file not required if this image is build for SLES x86_64) Thanks, Ramesh. On 11/30/2016 12:10 PM, Vo Minh Hoang wrote: > Dear Mahesh,o > > I will do following your request. > Please note that test case executing time is very long so result might not > be available in today. > > Thank you and best regards, > Hoang > > -Original Message- > From: A V Mahesh [mailto:mahesh.va...@oracle.com] > Sent: Wednesday, November 30, 2016 1:35 PM > To: Vo Minh Hoang > Cc: opensaf-devel@lists.sourceforge.net; ramesh.bet...@oracle.com > Subject: Re: [PATCH 0 of 3] Review Request for leap : now leap library > ensure shm availability before writing [#2202] > > Hi Hoang, > > Apply these change test and provide sys log at the time issue occurred. > > > > > diff --git a/osaf/libs/core/leap/os_defs.c b/osaf/libs/core/leap/os_defs.c > --- a/osaf/libs/core/leap/os_defs.c > +++ b/osaf/libs/core/leap/os_defs.c > @@ -865,11 +865,15 @@ uint32_t ncs_os_posix_shm(NCS_OS_POSIX_S > } > > /* Checking whether sufficient shared memory is > available to write the data, to be safer side ffree reduced to 1 block size > */ > - if (req->info.write.i_write_size > > (statsvfs.f_bfree * statsvfs.f_frsize)) { > + if (req->info.write.i_write_size > > ((statsvfs.f_bfree - 1) * statsvfs.f_frsize)) { > syslog(LOG_ERR, "Insufficient shared memory > space (%ld) available to write the data of size: %ld \n", > (statsvfs.f_bfree * > statsvfs.f_frsize), req->info.write.i_write_size); > return NCSCC_RC_FAILURE; > + } else { > + syslog(LOG_ERR, "Sufficient shared > memory space (%ld) available to write the data of size: %ld \n", > +(statsvfs.f_bfree * > statsvfs.f_frsize), req->info.write.i_write_size); > } > + > } > memcpy((void *)((char *)req->info.write.i_addr + > req->info.write.i_offset), req->info.write.i_from_buff, > req->info.write.i_write_size); > > > > > -AVM > > On 11/30/2016 11:56 AM, A V Mahesh wrote: >> Hi Hoang, >> >> Thansk for the test . >> >> Then it looks issue is not related to SHM deficiency ( 100 % used by >> other application ) can you please re-test with below changes and >> that will confirm us it is completely not related to SHM free size. >> >> replacing: >> >> `if (req->info.write.i_write_size > (statsvfs.f_bfree * >> statsvfs.f_frsize)) {` >> >> with below, to be safer side ffree reduced to 1 block size : >> >> `if (req->info.write.i_write_size > ((statsvfs.f_bfree - 1) * >> statsvfs.f_frsize)) { >> >> >> -AVM >> >> >> On 11/30/2016 11:37 AM, Vo Minh Hoang wrote: >>> Dear Mahesh, >>> >>> Unfortunately, I have just receive information that the same core >>> dump still occur after applying patch. >>> >>> Here is dump information in short, please tell me if I can do >>> anything in >>> support: >>> >>> Program terminated with signal SIGSEGV, Segmentation fault. >>> #0 0x7fe314aa0109 in __memcpy_sse2_unaligned () from >>> /lib64/libc.so.6 >>> Missing separate debuginfos, use: zypper install >>> opensaf-ckpt-nodedirector-debuginfo-5.1.0-.0.4997518.sle12.x86_64 >>> (gdb) where >>> #0 0x7fe314aa0109 in __memcpy_sse2_unaligned () from >>> /lib64/libc.so.6 >>> #1 0x7fe315c26082 in memcpy (__len=, >>> __src=>> out>, __dest=) >>> at /usr/include/x86_64-linux-gnu/bits/string3.h:51 >>> #2 ncs_os_posix_shm (req=req@entry=0x7ffecb80adb0) at os_defs.c:874 >>> #3 0x00415a80 in cpnd_sec_hdr_update (cb=cb@entry=0x9e57f0, >>> sec_info=sec_info@entry=0xb8ff60, >>> cp_node=cp_node@entry=0xb8e8c0) at cpnd_proc.c:1880 >>> #4 0x00406047 in cpnd_ckpt_sec_add (cb=cb@entry=0x9e57f0, >>> cp_node=0xb8e8c0, id=0x7fe30c002390, >>> exp_time=1480480471343486000, gen_flag=gen_flag@entry=0) at >>> cpnd_db.c:457 >>> #5 0x0040d17c in cpnd_evt_proc_ckpt_sect_create >>> (cb=cb@entry=0x9e57f0, >>> evt=evt@entry=0x7fe30c01e1d0, sinfo=sinfo@entry=0x7fe30c01e828) >>> at >>> cpnd_evt.c:2267 >>> #6 0x0040eaf4 in cpnd_process_evt (evt=0x7fe30c01e1c0) at >>> cpnd_evt.c:227 >>> #7 0x004106cd in cpnd_main_process (cb=cb@entry=0x9e57f0) at >>> cpnd_init.c:579 >>> #8 0x00405383 in main (argc=, argv=>> out>) >>> at cpnd_main.c:79 >>> >>> Sincerely, >>> Hoang >>> >>> -Original Message- >>> From: mahesh.va
Re: [devel] [PATCH 2 of 3] cpsv : update cpsv error handing based on leap changes [#2202]
Hi Mahesh, Please find my review comments inline with [Ramesh]. Thanks, Ramesh. On 11/29/2016 4:07 PM, mahesh.va...@oracle.com wrote: > osaf/libs/common/cpsv/include/cpnd_cb.h | 4 +- > osaf/libs/common/cpsv/include/cpnd_init.h | 8 +- > osaf/libs/common/cpsv/include/cpnd_sec.h | 2 +- > osaf/libs/core/include/ncs_osprm.h| 2 +- > osaf/services/saf/cpsv/cpnd/cpnd_db.c | 12 ++-- > osaf/services/saf/cpsv/cpnd/cpnd_evt.c| 82 > +- > osaf/services/saf/cpsv/cpnd/cpnd_proc.c | 31 ++ > osaf/services/saf/cpsv/cpnd/cpnd_res.c| 24 +++-- > osaf/services/saf/cpsv/cpnd/cpnd_sec.cc | 12 ++-- > 9 files changed, 103 insertions(+), 74 deletions(-) > > > diff --git a/osaf/libs/common/cpsv/include/cpnd_cb.h > b/osaf/libs/common/cpsv/include/cpnd_cb.h > --- a/osaf/libs/common/cpsv/include/cpnd_cb.h > +++ b/osaf/libs/common/cpsv/include/cpnd_cb.h > @@ -341,8 +341,8 @@ uint32_t cpnd_amf_register(CPND_CB *cpnd > uint32_t cpnd_amf_deregister(CPND_CB *cpnd_cb); > uint32_t cpnd_client_extract_bits(uint32_t bitmap_value, uint32_t > *bit_position); > uint32_t cpnd_res_ckpt_sec_del(CPND_CKPT_NODE *cp_node); > -uint32_t cpnd_ckpt_replica_create_res(NCS_OS_POSIX_SHM_REQ_INFO *open_req, > char *buf, CPND_CKPT_NODE **cp_node, > - uint32_t ref_cnt, CKPT_INFO > *cp_info, bool shm_alloc_guaranteed); > +uint32_t cpnd_ckpt_replica_create_res(CPND_CB *cb, NCS_OS_POSIX_SHM_REQ_INFO > *open_req, char *buf, CPND_CKPT_NODE **cp_node, > + uint32_t ref_cnt, CKPT_INFO > *cp_info); > int32_t cpnd_find_free_loc(CPND_CB *cb, CPND_TYPE_INFO type); > uint32_t cpnd_ckpt_write_header(CPND_CB *cb, uint32_t nckpts); > uint32_t cpnd_cli_info_write_header(CPND_CB *cb, int32_t n_clients); > diff --git a/osaf/libs/common/cpsv/include/cpnd_init.h > b/osaf/libs/common/cpsv/include/cpnd_init.h > --- a/osaf/libs/common/cpsv/include/cpnd_init.h > +++ b/osaf/libs/common/cpsv/include/cpnd_init.h > @@ -90,7 +90,7 @@ uint32_t cpnd_ckpt_replica_create(CPND_C > uint32_t cpnd_ckpt_remote_cpnd_add(CPND_CKPT_NODE *cp_node, MDS_DEST > mds_info); > uint32_t cpnd_ckpt_remote_cpnd_del(CPND_CKPT_NODE *cp_node, MDS_DEST > mds_info); > int32_t cpnd_ckpt_get_lck_sec_id(CPND_CKPT_NODE *cp_node); > -uint32_t cpnd_ckpt_sec_write(CPND_CKPT_NODE *cp_node, CPND_CKPT_SECTION_INFO > +uint32_t cpnd_ckpt_sec_write(CPND_CB *cb, CPND_CKPT_NODE *cp_node, > CPND_CKPT_SECTION_INFO > *sec_info, const void *data, uint64_t size, uint64_t > offset, uint32_t type); > uint32_t cpnd_ckpt_sec_read(CPND_CKPT_NODE *cp_node, CPND_CKPT_SECTION_INFO >*sec_info, void *data, uint64_t size, uint64_t offset); > @@ -164,7 +164,7 @@ void cpnd_evt_node_getnext(CPND_CB *cb, > uint32_t cpnd_evt_node_add(CPND_CB *cb, CPSV_CPND_ALL_REPL_EVT_NODE > *evt_node); > uint32_t cpnd_evt_node_del(CPND_CB *cb, CPSV_CPND_ALL_REPL_EVT_NODE > *evt_node); > CPND_CKPT_NODE *cpnd_ckpt_node_find_by_name(CPND_CB *cpnd_cb, > SaConstStringT ckpt_name); > -CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_add(CPND_CKPT_NODE *cp_node, > SaCkptSectionIdT *id, SaTimeT exp_time, > +CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_add(CPND_CB *cb, CPND_CKPT_NODE > *cp_node, SaCkptSectionIdT *id, SaTimeT exp_time, > uint32_t gen_flag); > void cpnd_evt_backup_queue_add(CPND_CKPT_NODE *cp_node, CPND_EVT *evt); > uint32_t cpnd_ckpt_node_tree_init(CPND_CB *cb); > @@ -176,8 +176,8 @@ void cpnd_client_node_tree_cleanup(CPND_ > void cpnd_client_node_tree_destroy(CPND_CB *cb); > void cpnd_allrepl_write_evt_node_tree_cleanup(CPND_CB *cb); > void cpnd_allrepl_write_evt_node_tree_destroy(CPND_CB *cb); > -uint32_t cpnd_sec_hdr_update(CPND_CKPT_SECTION_INFO *pSecPtr, CPND_CKPT_NODE > *cp_node); > -uint32_t cpnd_ckpt_hdr_update(CPND_CKPT_NODE *cp_node); > +uint32_t cpnd_sec_hdr_update(CPND_CB *cb, CPND_CKPT_SECTION_INFO *pSecPtr, > CPND_CKPT_NODE *cp_node); > +uint32_t cpnd_ckpt_hdr_update(CPND_CB *cb, CPND_CKPT_NODE *cp_node); > void cpnd_ckpt_node_destroy(CPND_CB *cb, CPND_CKPT_NODE *cp_node); > uint32_t cpnd_get_slot_sub_slot_id_from_mds_dest(MDS_DEST dest); > uint32_t cpnd_get_slot_sub_slot_id_from_node_id(NCS_NODE_ID i_node_id); > diff --git a/osaf/libs/common/cpsv/include/cpnd_sec.h > b/osaf/libs/common/cpsv/include/cpnd_sec.h > --- a/osaf/libs/common/cpsv/include/cpnd_sec.h > +++ b/osaf/libs/common/cpsv/include/cpnd_sec.h > @@ -39,7 +39,7 @@ CPND_CKPT_SECTION_INFO * > cpnd_ckpt_sec_get_create(const CPND_CKPT_NODE *, const SaCkptSectionIdT *); > > CPND_CKPT_SECTION_INFO * > -cpnd_ckpt_sec_del(CPND_CKPT_NODE *, SaCkptSectionIdT *); > +cpnd_ckpt_sec_del(CPND_CB *cb, CPND_CKPT_NODE *, SaCkptSectionIdT *); > > CPND_CKPT_SECTION_INFO * > cpnd_get_sect_with_id(const CPND_CKPT_NODE *, uint32_t lcl_sec_id); > diff --git a/osaf/libs/core/include/ncs_ospr
Re: [devel] [PATCH 1 of 1] opensafd: Disallow parallel execution of opensafd operations start and stop [#2244]
Minor comments on top of Anders comments. * Typo correction: logger -t $osafprog "opensafd start/stop already in progress. Unable to *contiune* * Also there might be the possibility of not removing the $lockfile_inprogress in due of fast reboot. Please check. /+logger -t $osafprog "Starting OpenSAF failed, rebooting..." // //+sleep $REBOOT_ON_FAIL_TIMEOUT // //+/sbin/reboot & // //+else // //+logger -t $osafprog "Starting OpenSAF failed" // //+fi // // fi // //+rm -rf "$lockfile_inprogress" // / Best Regards, Ramesh. On 1/3/2017 6:11 PM, Anders Widell wrote: > Ack with comments: > > 1) Better to use "rm -f" instead of "rm -rf" to remove the lock file, > since "rm -rf" could be dangerous if the parameter is wrong. > > 2) Maybe also use log_failure_msg (or log_warning_msg) instead of just > logger, so that you get messages on the screen when calling > /etc/init.d/opensafd from the command prompt. > > regards, > > Anders Widell > > > On 12/22/2016 02:17 PM, Hans Nordeback wrote: >> osaf/services/infrastructure/nid/scripts/opensafd.in | 105 >> +++--- >> 1 files changed, 62 insertions(+), 43 deletions(-) >> >> >> diff --git a/osaf/services/infrastructure/nid/scripts/opensafd.in >> b/osaf/services/infrastructure/nid/scripts/opensafd.in >> --- a/osaf/services/infrastructure/nid/scripts/opensafd.in >> +++ b/osaf/services/infrastructure/nid/scripts/opensafd.in >> @@ -14,6 +14,7 @@ >> osafdirfile=@sysconfdir@/@PACKAGE_NAME@/osafdir.conf >> osafprog="opensafd" >> +osafprog_inprogress="opensafd_inprogress" >> # Source LSB functions library >> . /lib/lsb/init-functions >> @@ -28,6 +29,7 @@ fi >> binary=$pkglibdir/$osafprog >> lockfile=$lockdir/$osafprog >> +lockfile_inprogress=$lockdir/$osafprog_inprogress >> amfnd_bin=$pkglibdir/osafamfnd >> amfnd_pid=$pkgpiddir/osafamfnd.pid >> @@ -216,22 +218,30 @@ start() { >> #enable_coredump >> echo -n "Starting OpenSAF Services (Using $MDS_TRANSPORT):" >> -start_daemon $binary $args >> -RETVAL=$? >> -if [ $RETVAL -eq 0 ]; then >> -logger -t $osafprog "OpenSAF($osafversion - $osafcshash) >> services successfully started" >> -touch $lockfile >> -log_success_msg >> +if [ -e "$lockfile_inprogress" ]; then >> +RETVAL=1 >> +logger -t $osafprog "opensafd start/stop already in >> progress. Unable to contiune" >> +logger -t $osafprog "To forcefully start/stop OpenSAF remove >> $lockfile_inprogress" >> else >> -final_clean >> -log_failure_msg >> -if [ $REBOOT_ON_FAIL_TIMEOUT -ne 0 ]; then >> -logger -t $osafprog "Starting OpenSAF failed, rebooting..." >> -sleep $REBOOT_ON_FAIL_TIMEOUT >> -/sbin/reboot & >> +touch "$lockfile_inprogress" >> +start_daemon $binary $args >> +RETVAL=$? >> +if [ $RETVAL -eq 0 ]; then >> +logger -t $osafprog "OpenSAF($osafversion - $osafcshash) >> services successfully started" >> +touch $lockfile >> +log_success_msg >> else >> -logger -t $osafprog "Starting OpenSAF failed" >> +final_clean >> +log_failure_msg >> +if [ $REBOOT_ON_FAIL_TIMEOUT -ne 0 ]; then >> +logger -t $osafprog "Starting OpenSAF failed, >> rebooting..." >> +sleep $REBOOT_ON_FAIL_TIMEOUT >> +/sbin/reboot & >> +else >> +logger -t $osafprog "Starting OpenSAF failed" >> +fi >> fi >> +rm -rf "$lockfile_inprogress" >> fi >> return $RETVAL >> } >> @@ -239,40 +249,49 @@ start() { >> stop() { >> logger -t $osafprog "Stopping OpenSAF Services" >> -amfpid=`pidofproc -p $amfnd_pid $amfnd_bin` >> -echo -n "Stopping OpenSAF Services: " >> -if [ -n "$amfpid" ]; then >> -kill $amfpid >> -timeout=$TERMTIMEOUT >> -while [ $timeout -gt 0 ]; do >> -sleep 1 >> -[ -d /proc/$amfpid ] || break >> -timeout=$((timeout-1)) >> -done >> -[ -d /proc/$amfpid ] && RETVAL=1 >> -if [ $RETVAL -eq 1 ]; then >> -logger -t $osafprog "amfnd has not yet exited, killing >> it forcibly." >> -kill -9 $amfpid >> +if [ -e "$lockfile_inprogress" ]; then >> +RETVAL=1 >> +logger -t $osafprog "opensafd start/stop already in >> progress. Unable to contiune" >> +logger -t $osafprog "To forcefully start/stop OpenSAF remove >> $lockfile_inprogress" >> +else >> +touch "$lockfile_inprogress" >> +amfpid=`pidofproc -p $amfnd_pid $amfnd_bin` >> +echo -n "Stopping OpenSAF Services: " >> +if [ -n "$amfpid" ]; then >> +kill $amfpid >> +timeout=$TER
Re: [devel] [PATCH 1 of 1] opensafd: Disallow parallel execution of opensafd operations start and stop [#2244]
Done. Thanks, Ramesh. On 1/4/2017 2:35 PM, Hans Nordebäck wrote: > Hi Ramesh, > > A gentle reminder for review/Thanks HansN > > -Original Message- > From: Hans Nordeback [mailto:hans.nordeb...@ericsson.com] > Sent: den 22 december 2016 14:17 > To: ramesh.bet...@oracle.com; Anders Widell > Cc: opensaf-devel@lists.sourceforge.net > Subject: [devel] [PATCH 1 of 1] opensafd: Disallow parallel execution of > opensafd operations start and stop [#2244] > > osaf/services/infrastructure/nid/scripts/opensafd.in | 105 > +++--- > 1 files changed, 62 insertions(+), 43 deletions(-) > > > diff --git a/osaf/services/infrastructure/nid/scripts/opensafd.in > b/osaf/services/infrastructure/nid/scripts/opensafd.in > --- a/osaf/services/infrastructure/nid/scripts/opensafd.in > +++ b/osaf/services/infrastructure/nid/scripts/opensafd.in > @@ -14,6 +14,7 @@ > > osafdirfile=@sysconfdir@/@PACKAGE_NAME@/osafdir.conf > osafprog="opensafd" > +osafprog_inprogress="opensafd_inprogress" > > # Source LSB functions library > . /lib/lsb/init-functions > @@ -28,6 +29,7 @@ fi > > binary=$pkglibdir/$osafprog > lockfile=$lockdir/$osafprog > +lockfile_inprogress=$lockdir/$osafprog_inprogress > amfnd_bin=$pkglibdir/osafamfnd > amfnd_pid=$pkgpiddir/osafamfnd.pid > > @@ -216,22 +218,30 @@ start() { > #enable_coredump > > echo -n "Starting OpenSAF Services (Using $MDS_TRANSPORT):" > - start_daemon $binary $args > - RETVAL=$? > - if [ $RETVAL -eq 0 ]; then > - logger -t $osafprog "OpenSAF($osafversion - $osafcshash) > services successfully started" > - touch $lockfile > - log_success_msg > + if [ -e "$lockfile_inprogress" ]; then > + RETVAL=1 > + logger -t $osafprog "opensafd start/stop already in progress. > Unable to contiune" > + logger -t $osafprog "To forcefully start/stop OpenSAF remove > $lockfile_inprogress" > else > - final_clean > - log_failure_msg > - if [ $REBOOT_ON_FAIL_TIMEOUT -ne 0 ]; then > - logger -t $osafprog "Starting OpenSAF failed, > rebooting..." > - sleep $REBOOT_ON_FAIL_TIMEOUT > - /sbin/reboot & > + touch "$lockfile_inprogress" > + start_daemon $binary $args > + RETVAL=$? > + if [ $RETVAL -eq 0 ]; then > + logger -t $osafprog "OpenSAF($osafversion - > $osafcshash) services successfully started" > + touch $lockfile > + log_success_msg > else > - logger -t $osafprog "Starting OpenSAF failed" > + final_clean > + log_failure_msg > + if [ $REBOOT_ON_FAIL_TIMEOUT -ne 0 ]; then > + logger -t $osafprog "Starting OpenSAF failed, > rebooting..." > + sleep $REBOOT_ON_FAIL_TIMEOUT > + /sbin/reboot & > + else > + logger -t $osafprog "Starting OpenSAF failed" > + fi > fi > + rm -rf "$lockfile_inprogress" > fi > return $RETVAL > } > @@ -239,40 +249,49 @@ start() { > stop() { > logger -t $osafprog "Stopping OpenSAF Services" > > - amfpid=`pidofproc -p $amfnd_pid $amfnd_bin` > - echo -n "Stopping OpenSAF Services: " > - if [ -n "$amfpid" ]; then > - kill $amfpid > - timeout=$TERMTIMEOUT > - while [ $timeout -gt 0 ]; do > - sleep 1 > - [ -d /proc/$amfpid ] || break > - timeout=$((timeout-1)) > - done > - [ -d /proc/$amfpid ] && RETVAL=1 > - if [ $RETVAL -eq 1 ]; then > - logger -t $osafprog "amfnd has not yet exited, killing > it forcibly." > - kill -9 $amfpid > + if [ -e "$lockfile_inprogress" ]; then > + RETVAL=1 > + logger -t $osafprog "opensafd start/stop already in progress. > Unable to contiune" > + logger -t $osafprog "To forcefully start/stop OpenSAF remove > $lockfile_inprogress" > + else > + touch "$lockfile_inprogress" > + amfpid=`pidofproc -p $amfnd_pid $amfnd_bin` > + echo -n "Stopping OpenSAF Services: " > + if [ -n "$amfpid" ]; then > + kill $amfpid > + timeout=$TERMTIMEOUT > + while [ $timeout -gt 0 ]; do > + sleep 1 > + [ -d /proc/$amfpid ] || break > + timeout=$((timeout-1)) > + done > + [ -d /proc/$amfpid ] && RETVAL=1 > + if [ $RETVAL -eq 1 ]; then > + logger
Re: [devel] [PATCH 0 of 2] Review Request for base: Unlink the UNIX socket in the UnixServerSocket destructor [#2231]
Ack for all patches. Regards, Ramesh. On 12/20/2016 2:31 PM, Anders Widell wrote: > Summary: base: Unlink the UNIX socket in the UnixServerSocket destructor > [#2231] > Review request for Trac Ticket(s): 2231 > Peer Reviewer(s): Ramesh > Pull request to: > Affected branch(es): default(5.2) > Development branch: default > > > Impacted area Impact y/n > > Docsn > Build systemn > RPM/packaging n > Configuration files n > Startup scripts n > SAF servicesn > OpenSAF servicesn > Core libraries y > Samples n > Tests n > Other n > > > Comments (indicate scope for each "y" above): > - > > changeset bdfef9daf333161f7d19ae968efc594304136c41 > Author: Anders Widell > Date: Tue, 20 Dec 2016 09:58:33 +0100 > > base: Unlink the UNIX socket in the UnixServerSocket destructor [#2231] > > The virtual method UnixServerSocket::CloseHook() was not called from the > UnixSocket destructor (since it is a virtual method in a subclass). > Instead, > unlink the socket file in the UnixServerSocket destructor. > > changeset 06b6310509377a90f05edc4f34e72135cec49dc0 > Author: Anders Widell > Date: Tue, 20 Dec 2016 09:58:36 +0100 > > base: Add unit test for UnixServerSocket destructor [#2231] > > > Complete diffstat: > -- > osaf/libs/core/cplusplus/base/tests/Makefile.am | 3 +++ > osaf/libs/core/cplusplus/base/tests/unix_socket_test.cc | 74 > ++ > osaf/libs/core/cplusplus/base/unix_server_socket.cc | 1 + > osaf/libs/core/cplusplus/base/unix_socket.cc| 4 +++- > 4 files changed, 81 insertions(+), 1 deletions(-) > > > Testing Commands: > - > make check > > > Testing, Expected Results: > -- > unit tests should pass > > > Conditions of Submission: > - > Ack from reviewer(s) > > > Arch Built StartedLinux distro > --- > mipsn n > mips64 n n > x86 n n > x86_64 y y > powerpc n n > powerpc64 n n > > > Reviewer Checklist: > --- > [Submitters: make sure that your review doesn't trigger any checkmarks!] > > > Your checkin has not passed review because (see checked entries): > > ___ Your RR template is generally incomplete; it has too many blank entries > that need proper data filled in. > > ___ You have failed to nominate the proper persons for review and push. > > ___ Your patches do not have proper short+long header > > ___ You have grammar/spelling in your header that is unacceptable. > > ___ You have exceeded a sensible line length in your headers/comments/text. > > ___ You have failed to put in a proper Trac Ticket # into your commits. > > ___ You have incorrectly put/left internal data in your comments/files > (i.e. internal bug tracking tool IDs, product names etc) > > ___ You have not given any evidence of testing beyond basic build tests. > Demonstrate some level of runtime or other sanity testing. > > ___ You have ^M present in some of your files. These have to be removed. > > ___ You have needlessly changed whitespace or added whitespace crimes > like trailing spaces, or spaces before tabs. > > ___ You have mixed real technical changes with whitespace and other > cosmetic code cleanup changes. These have to be separate commits. > > ___ You need to refactor your submission into logical chunks; there is > too much content into a single commit. > > ___ You have extraneous garbage in your review (merge commits etc) > > ___ You have giant attachments which should never have been sent; > Instead you should place your content in a public tree to be pulled. > > ___ You have too many commits attached to an e-mail; resend as threaded > commits, or place in a public tree for a pull. > > ___ You have resent this content multiple times without a clear indication > of what has changed between each re-send. > > ___ You have failed to adequately and individually address all of the > comments and change requests that were proposed in the initial review. > > ___ You have a misconfigured ~/.hgrc file (i.e. username, email etc) > > ___ Your computer have a badly configured date and time; confusing the > the threaded patch review. > > ___ Your changes affect IPC mechanism, and you don't present any results > for in-service upgradability test. > > ___ Your changes affect user manual and documentation, your patch series > do not contain the patch that updates the Doxygen manual. > ---
Re: [devel] [PATCH 1 of 1] leap: fix sysfTmrCreate and return values [#2246]
Ack. Thanks, Ranesh. On 1/2/2017 3:27 PM, Zoran Milinkovic wrote: > osaf/libs/core/leap/sysf_def.c | 2 +- > osaf/libs/core/leap/sysf_tmr.c | 23 ++- > 2 files changed, 19 insertions(+), 6 deletions(-) > > > Fix sysfTmrCreate and return values. > > diff --git a/osaf/libs/core/leap/sysf_def.c b/osaf/libs/core/leap/sysf_def.c > --- a/osaf/libs/core/leap/sysf_def.c > +++ b/osaf/libs/core/leap/sysf_def.c > @@ -95,7 +95,7 @@ uint32_t leap_env_init(void) > > #if (NCSL_ENV_INIT_TMR == 1) > /* initialize LEAP Timer Service */ > - if (sysfTmrCreate() != NCSCC_RC_SUCCESS) { > + if (!sysfTmrCreate()) { > printf("\nleap_env_init: FAILED to initialize Timer Service\n"); > return NCSCC_RC_FAILURE; > } > diff --git a/osaf/libs/core/leap/sysf_tmr.c b/osaf/libs/core/leap/sysf_tmr.c > --- a/osaf/libs/core/leap/sysf_tmr.c > +++ b/osaf/libs/core/leap/sysf_tmr.c > @@ -472,10 +472,9 @@ bool sysfTmrCreate(void) > { > NCS_PATRICIA_PARAMS pat_param; > uint32_t rc = NCSCC_RC_SUCCESS; > + bool prev_tmr_destroying; > > - if (ncs_tmr_create_done == false) > - ncs_tmr_create_done = true; > - else > + if (ncs_tmr_create_done == true) > return true; > > /* Empty Timer Service control block. */ > @@ -494,14 +493,19 @@ bool sysfTmrCreate(void) > > rc = ncs_patricia_tree_init(&gl_tcb.tmr_pat_tree, &pat_param); > if (rc != NCSCC_RC_SUCCESS) { > - return NCSCC_RC_FAILURE; > + m_NCS_LOCK_DESTROY(&gl_tcb.safe.enter_lock); > + m_NCS_LOCK_DESTROY(&gl_tcb.safe.free_lock); > + return false; > } > > rc = m_NCS_SEL_OBJ_CREATE(&gl_tcb.sel_obj); > if (rc != NCSCC_RC_SUCCESS) { > ncs_patricia_tree_destroy(&gl_tcb.tmr_pat_tree); > - return NCSCC_RC_FAILURE; > + m_NCS_LOCK_DESTROY(&gl_tcb.safe.enter_lock); > + m_NCS_LOCK_DESTROY(&gl_tcb.safe.free_lock); > + return false; > } > + prev_tmr_destroying = tmr_destroying; > tmr_destroying = false; > > /* create expiry thread */ > @@ -515,17 +519,26 @@ bool sysfTmrCreate(void) > 0, > (char *)"OSAF_TMR", > prio_val, policy, NCS_TMR_STACKSIZE, > &gl_tcb.p_tsk_hdl) != NCSCC_RC_SUCCESS) { > + tmr_destroying = prev_tmr_destroying; > ncs_patricia_tree_destroy(&gl_tcb.tmr_pat_tree); > m_NCS_SEL_OBJ_DESTROY(&gl_tcb.sel_obj); > + m_NCS_LOCK_DESTROY(&gl_tcb.safe.enter_lock); > + m_NCS_LOCK_DESTROY(&gl_tcb.safe.free_lock); > return false; > } > > if (m_NCS_TASK_START(gl_tcb.p_tsk_hdl) != NCSCC_RC_SUCCESS) { > + tmr_destroying = prev_tmr_destroying; > m_NCS_TASK_RELEASE(gl_tcb.p_tsk_hdl); > ncs_patricia_tree_destroy(&gl_tcb.tmr_pat_tree); > m_NCS_SEL_OBJ_DESTROY(&gl_tcb.sel_obj); > + m_NCS_LOCK_DESTROY(&gl_tcb.safe.enter_lock); > + m_NCS_LOCK_DESTROY(&gl_tcb.safe.free_lock); > return false; > } > + > + ncs_tmr_create_done = true; > + > return true; > } > -- 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 of 1] base: fix memory leak and timer state in sysf_tmr.c [#2251]
Ack. No more comments on top of Anders comments. Thanks, Ramesh. On 1/10/2017 8:07 PM, Anders Widell wrote: > Ack with comments inline, marked AndersW> > > regards, > > Anders Widell > > > On 01/04/2017 03:28 PM, Zoran Milinkovic wrote: >> src/base/sysf_tmr.c | 9 - >> 1 files changed, 8 insertions(+), 1 deletions(-) >> >> >> Fix memory leak in ncs_tmr_add_pat_node() >> Fix timer state, so that the timer will not execute if >> ncs_tmr_start() fails >> >> diff --git a/src/base/sysf_tmr.c b/src/base/sysf_tmr.c >> --- a/src/base/sysf_tmr.c >> +++ b/src/base/sysf_tmr.c >> @@ -180,6 +180,7 @@ static struct timespec ts_start; >> static uint32_t ncs_tmr_add_pat_node(SYSF_TMR *tmr) >> { >> SYSF_TMR_PAT_NODE *temp_tmr_pat_node = NULL; >> +int rc; > AndersW> should be "unsigned int" to match the return type of > ncs_patricia_tree_add() >> temp_tmr_pat_node = (SYSF_TMR_PAT_NODE >> *)ncs_patricia_tree_get(&gl_tcb.tmr_pat_tree, (uint8_t *)&tmr->key); >> @@ -190,7 +191,11 @@ static uint32_t ncs_tmr_add_pat_node(SYS >> memset(temp_tmr_pat_node, '\0', sizeof(SYSF_TMR_PAT_NODE)); >> temp_tmr_pat_node->key = tmr->key; >> temp_tmr_pat_node->pat_node.key_info = (uint8_t >> *)&temp_tmr_pat_node->key; >> -ncs_patricia_tree_add(&gl_tcb.tmr_pat_tree, >> (NCS_PATRICIA_NODE *)&temp_tmr_pat_node->pat_node); >> +rc = ncs_patricia_tree_add(&gl_tcb.tmr_pat_tree, >> (NCS_PATRICIA_NODE *)&temp_tmr_pat_node->pat_node); >> +if(rc != NCSCC_RC_SUCCESS) { >> +m_NCS_MEM_FREE(temp_tmr_pat_node, >> NCS_MEM_REGION_PERSISTENT, NCS_SERVICE_ID_LEAP_TMR, 0); >> +return NCSCC_RC_FAILURE; >> +} >> } >> if (temp_tmr_pat_node->tmr_list_start == NULL) { >> @@ -733,6 +738,8 @@ tmr_t ncs_tmr_start(tmr_t tid, int64_t t >> on the "sel_obj". */ >> if (m_NCS_SEL_OBJ_IND(&gl_tcb.sel_obj) != NCSCC_RC_SUCCESS) { >> /* We would never reach here! */ >> +/* Ignore this timer. Indication was not successfully >> sent */ >> +TMR_SET_STATE(tmr, TMR_STATE_DESTROY); > AndersW> I think it is better to call osaf_abort() in this error case, > since there must be some serious problem. Setting the timer state to > TMR_STATE_DESTROY could be dangerous - doesn't that mean that the > timer could be re-used by someone else? >> m_NCS_UNLOCK(&gl_tcb.safe.enter_lock, NCS_LOCK_WRITE); >> m_LEAP_DBG_SINK_VOID; >> return NULL; >> >> -- >> >> >> 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 >> > -- 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 of 1] base: synchronize timer thread with the main thread [#2248]
Hi, I am not able to correlate this patch with the problem description of #2248. I see the changes mentioned in the patch are not required. Probably need to do more evaluation why the test hangs forever for SysfTmrTest.TestIntervalTimer. Any supporting logs? Thanks, Ramesh. On 1/10/2017 6:48 PM, Anders Widell wrote: > Hi! > > I don't understand this patch. To me it looks like both the timer > thread and the main thread will be waiting on the same selection > object (gl_tcb.sel_obj). Shouldn't a separate selection object be used > to synchronize thread start-up, to avoid a race here? Secondly, I > don't understand why we need this synchronization in the first place. > Shouldn't the timer functions work no matter if the timer thread is > running or not? Of course, no timer will expire until the timer thread > has started, but it should be possible to create timers regardless of > whether the thread is running or not. > > regards, > > Anders Widell > > On 01/03/2017 04:42 PM, Zoran Milinkovic wrote: >> src/base/sysf_tmr.c | 16 >> 1 files changed, 16 insertions(+), 0 deletions(-) >> >> >> sysfTmrCreate() will wait for max 1 second for the timer thread to be >> fully ready to start timers. >> >> diff --git a/src/base/sysf_tmr.c b/src/base/sysf_tmr.c >> --- a/src/base/sysf_tmr.c >> +++ b/src/base/sysf_tmr.c >> @@ -402,6 +402,10 @@ static uint32_t ncs_tmr_wait(void) >> ts_current = ts_start; >> +/* Send the first indication to the selection object >> + * to synchronize threads */ >> +m_NCS_SEL_OBJ_IND(&gl_tcb.sel_obj); >> + >> while (true) { >> set.fd = m_GET_FD_FROM_SEL_OBJ(gl_tcb.sel_obj); >> set.events = POLLIN; >> @@ -526,6 +530,18 @@ bool sysfTmrCreate(void) >> m_NCS_SEL_OBJ_DESTROY(&gl_tcb.sel_obj); >> return false; >> } >> + >> +/* Wait for max 1 sec for ncs_tmr_wait() to be fully ready. >> + * The function fails if the timer thread is not ready within 1 >> sec */ >> +rc = osaf_poll_one_fd(gl_tcb.sel_obj.rmv_obj, 1000); >> +if(rc != 1) { >> +m_NCS_TASK_RELEASE(gl_tcb.p_tsk_hdl); >> +ncs_patricia_tree_destroy(&gl_tcb.tmr_pat_tree); >> +m_NCS_SEL_OBJ_DESTROY(&gl_tcb.sel_obj); >> +return false; >> +} >> +m_NCS_SEL_OBJ_RMV_IND(&gl_tcb.sel_obj, true, true); >> + >> return true; >> } >> >> -- >> >> >> 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 >> > -- 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 of 1] base: Improve TRACE_ENTER, TRACE_LEAVE macros [#2262]
Ack. Thanks, Ramesh. On 1/19/2017 7:45 PM, Anders Widell wrote: > Ack with minor comment marked AndersW> > > regards, > > Anders Widell > > > On 01/13/2017 10:40 AM, Hans Nordeback wrote: >> src/amf/amfd/ckpt_dec.cc | 2 + >> src/amf/amfd/clm.cc | 2 + >> src/amf/amfd/csi.cc | 7 - >> src/amf/amfd/node.cc | 4 ++- >> src/amf/amfd/nodegroup.cc| 4 ++- >> src/amf/amfd/si_dep.cc | 1 + >> src/amf/amfnd/pgdb.cc| 4 +- >> src/amf/amfnd/su.cc | 2 + >> src/base/logtrace.c | 18 +--- >> src/base/logtrace.h | 48 >> >> src/imm/agent/imma_init.cc | 7 +++- >> src/imm/agent/imma_om_api.cc | 2 - >> src/imm/immnd/ImmModel.cc| 16 ++-- >> src/imm/immpbed/immpbe_daemon.cc | 4 ++- >> src/log/logd/lgs_imm_gcfg.cc | 2 + >> src/log/logd/lgs_main.cc | 2 + >> src/log/logd/lgs_mbcsv.cc| 2 + >> src/ntf/ntfd/NtfClient.cc| 2 +- >> src/smf/smfd/SmfCampaignXmlParser.cc | 3 ++ >> src/smf/smfd/SmfUpgradeStep.cc | 3 ++ >> 20 files changed, 111 insertions(+), 24 deletions(-) >> >> >> diff --git a/src/amf/amfd/ckpt_dec.cc b/src/amf/amfd/ckpt_dec.cc >> --- a/src/amf/amfd/ckpt_dec.cc >> +++ b/src/amf/amfd/ckpt_dec.cc >> @@ -370,6 +370,8 @@ static uint32_t dec_app_config(AVD_CL_CB >> uint32_t status = NCSCC_RC_SUCCESS; >> AVD_APP app; >> >> +TRACE_ENTER(); >> + >> osafassert(dec->i_action == NCS_MBCSV_ACT_UPDATE); >> decode_app(&dec->i_uba, &app); >> >> diff --git a/src/amf/amfd/clm.cc b/src/amf/amfd/clm.cc >> --- a/src/amf/amfd/clm.cc >> +++ b/src/amf/amfd/clm.cc >> @@ -83,6 +83,8 @@ static void clm_node_exit_validate(AVD_A >> bool reject = false; >> SaAisErrorT rc = SA_AIS_OK; >> +TRACE_ENTER(); >> + >> /* >>* Reject validate step on self node as this is active controller >>*/ >> diff --git a/src/amf/amfd/csi.cc b/src/amf/amfd/csi.cc >> --- a/src/amf/amfd/csi.cc >> +++ b/src/amf/amfd/csi.cc >> @@ -831,6 +831,7 @@ static void ccb_apply_delete_hdlr(CcbUti >> bool first_sisu = true; >> +TRACE_ENTER(); >> if (avd_cb->avail_state_avd != SA_AMF_HA_ACTIVE) { >> /* A double check whether csi has been deleted from DB or >> not and whether pointer stored userData >> is still valid. */ >> @@ -851,7 +852,7 @@ static void ccb_apply_delete_hdlr(CcbUti >> goto done; >> } >> -TRACE_ENTER2("'%s'", csi ? csi->name.c_str() : nullptr); >> +TRACE("'%s'", csi ? csi->name.c_str() : nullptr); >> /* Check whether si has been assigned to any SU. */ >> if ((nullptr != csi->si->list_of_sisu) && >> @@ -992,6 +993,8 @@ static void csi_ccb_apply_modify_hdlr(st >> **/ >> static void csi_ccb_apply_create_hdlr(struct CcbUtilOperationData >> *opdata) >> { >> +TRACE_ENTER(); >> + >> AVD_CSI *csi = nullptr; >> if ((csi = csi_db->find(Amf::to_string(&opdata->objectName))) >> == nullptr) { >> /* this check is added because, some times there is >> @@ -1027,6 +1030,8 @@ SaAisErrorT csi_assign_hdlr(AVD_CSI *csi >> AVD_COMP_CSI_REL *compcsi; >> SaAisErrorT rc = SA_AIS_ERR_NO_OP; >> +TRACE_ENTER(); >> + >> /* Check whether csi assignment is already in progress and if >> yes, then return. >> This csi will be assigned after the undergoing csi >> assignment gets over.*/ >> if (csi->si->list_of_sisu != nullptr) { >> diff --git a/src/amf/amfd/node.cc b/src/amf/amfd/node.cc >> --- a/src/amf/amfd/node.cc >> +++ b/src/amf/amfd/node.cc >> @@ -891,7 +891,9 @@ static void node_ccb_apply_cb(CcbUtilOpe >> void node_admin_state_set(AVD_AVND *node, SaAmfAdminStateT >> admin_state) >> { >> SaAmfAdminStateT old_state = node->saAmfNodeAdminState; >> - >> + >> +TRACE_ENTER(); >> + >> if (old_state == admin_state) >> return; >> osafassert(admin_state <= SA_AMF_ADMIN_SHUTTING_DOWN); >> diff --git a/src/amf/amfd/nodegroup.cc b/src/amf/amfd/nodegroup.cc >> --- a/src/amf/amfd/nodegroup.cc >> +++ b/src/amf/amfd/nodegroup.cc >> @@ -467,13 +467,15 @@ static SaAisErrorT ng_ccb_completed_dele >> AVD_AVND *node; >> AVD_AMF_NG *ng = avd_ng_get(Amf::to_string(&opdata->objectName)); >> +TRACE_ENTER(); >> + >> if (ng == nullptr) { >> LOG_WA("Could not find %s in nodegroup_db", >> osaf_extended_name_borrow(&opdata->objectName)); >> TRACE_LEAVE(); >> return SA_AIS_OK; >> } >> -TRACE_ENTER2("%u", ng->number_nodes()); >> +TRACE("%u", ng->number_nodes()); >> std::set::const_iterator iter; >> if ((ng->saAmfNGAdminState != SA_AMF_ADMIN_LO
Re: [devel] [PATCH 1 of 1] base: Remove the local persistence guard API [#2275]
Hi Anders, Quick comments. The purpose of having ncslpg_<...>() functions in sysf_tmr is to make sure to go through gracefull shutdown process. sysfTmrDestroy() is suppose to wait till all threads using sysfTmr to complete their tasks. Observed that ncslpg_destroy() should have been called in sysfTmrDestroy() to accomplish the defined purpose. Regards, Ramesh. On 1/24/2017 7:24 PM, Anders Widell wrote: > src/base/hj_hdl.c | 96 > +- > src/base/ncs_hdl_pub.h | 22 +-- > src/base/sysf_tmr.c| 34 ++--- > 3 files changed, 6 insertions(+), 146 deletions(-) > > > Remove the "local persistence guard" API since it is only referenced by the > OpenSAF timer implementation, and in there it servces no purpose since the > function ncslpg_destroy() is never called. > > diff --git a/src/base/hj_hdl.c b/src/base/hj_hdl.c > --- a/src/base/hj_hdl.c > +++ b/src/base/hj_hdl.c > @@ -1,6 +1,7 @@ > /* -*- OpenSAF -*- >* >* (C) Copyright 2008 The OpenSAF Foundation > + * Copyright Ericsson AB 2012, 2017 - All Rights Reserved. >* >* This program is distributed in the hope that it will be useful, but >* WITHOUT ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY > @@ -25,15 +26,6 @@ > See ncs_hdl.h for brief write-up of issues/capabilities. See the > ncshm_ calls. > > - This file also contains an implementation for a 'Local Persistence Guard', > - which is a cheap (in CPU cycles) persistence guard scheme (for read > - only object access, like the handle manager) that can be used when an > object > - that is known to exist needs a guard for some object that hangs off of this > - object. For example, the LEAP sysfpool has a global struct that always > exists. > - What we need to know and be assured of is that when we access memory, that > - the structures managed will persist (destroy() could be called after all) > - while we are in the middle of an operation. See the ncslpg_ calls. > - > > ** > */ > > @@ -718,89 +710,3 @@ void hm_unblock_him(HM_CELL *cell) > int rc = sem_post((sem_t*)cell->data); /* unblock that destroy thread > */ > osafassert(rc == 0); > } > - > -/*** > - * > - * > - * > - * P u b l i cL o c a l P e r s i s t e n c e G u a r d > - * > - * A P I s (prefix 'ncslpg_') > - * > - * > - * > - ***/ > - > -/* > - > - PROCEDURE NAME: ncslpg_take > - > - DESCRIPTION: If all validation stuff is in order return true, which > - means this thread can enter this object. > - > -*/ > - > -bool ncslpg_take(NCSLPG_OBJ *pg) > -{ > - m_NCS_OS_ATOMIC_INC(&(pg->inhere)); /* set first, ask later.. to > beat 'closing' */ > - if (pg->open == true) > - return true;/* its open, lets go in */ > - else > - m_NCS_OS_ATOMIC_DEC(&(pg->inhere)); > - return false; /* its closed */ > -} > - > -/* > - > - PROCEDURE NAME: ncslpg_give > - > - DESCRIPTION: decriment the refcount, as this thread is leaving now. > - > -*/ > - > -uint32_t ncslpg_give(NCSLPG_OBJ *pg, uint32_t ret) > -{ > - m_NCS_OS_ATOMIC_DEC(&(pg->inhere)); > - return ret; > -} > - > -/* > - > - PROCEDURE NAME: ncslpg_create > - > - DESCRIPTION: Put the passed NCSLPG_OBJ in start state. If its already > - in start state, return FAILURE. > - > -*/ > - > -uint32_t ncslpg_create(NCSLPG_OBJ *pg) > -{ > - if (pg->open == true) > - m_LEAP_DBG_SINK_VOID; > - pg->open = true; > - pg->inhere = 0; > - return NCSCC_RC_SUCCESS; > -} > - > -/* > - > - PROCEDURE NAME: ncslpg_destroy > - > - DESCRIPTION: Close this LPG. Wait for all other threads to leave > before > - returning to the invoker, allowing her to proceed. Note > - that if this object is already closed, this function > - returns false (invoker should not proceed, as the > object is > - already destroyed or being destoyed. > - > -*/ > - > -bool n
Re: [devel] [PATCH 1 of 1] base: Remove the local persistence guard API [#2275]
Hi Anders, Across OpenSAF code, ncshm_<...>_hdl() functions are serving the similar purpose. The reason for not noticing inconsistency in handling ncslpg_<> functions in sysf_tmr can be due to 1. Threads that are using timer calls are gracefully exited before the main thread exits (or) 2. The protection taken by applications through ncshm_<>_hdl() functions had made threads to exit in graceful manner. (or) 3. Main thread exiting and subsequently the respective process exiting might have hided the situation of thread status that is still live and processing sysf_tmr calls. Regards, Ramesh. On 1/25/2017 2:35 PM, Anders Widell wrote: > > Let't not become sentimental about old broke code. As noted, this > mechanism is currently broken and doesn't do anything useful in its > current form. I doubt that it has ever worked during the history of > the OpenSAF project. And if it was really needed, it is doubtful why > it would only be needed in the timer implementation and not anywhere else. > > regards, > > Anders Widell > > > On 01/25/2017 05:22 AM, ramesh betham wrote: >> Hi Anders, >> >> Quick comments. >> >> The purpose of having ncslpg_<...>() functions in sysf_tmr is to >> make sure to go through gracefull shutdown process. >> sysfTmrDestroy() is suppose to wait till all threads using >> sysfTmr to complete their tasks. Observed that ncslpg_destroy() >> should have been called in sysfTmrDestroy() to accomplish the >> defined purpose. >> >> Regards, >> Ramesh. >> >> On 1/24/2017 7:24 PM, Anders Widell wrote: >>> src/base/hj_hdl.c | 96 >>> +- >>> src/base/ncs_hdl_pub.h | 22 +-- >>> src/base/sysf_tmr.c| 34 ++--- >>> 3 files changed, 6 insertions(+), 146 deletions(-) >>> >>> >>> Remove the "local persistence guard" API since it is only referenced by the >>> OpenSAF timer implementation, and in there it servces no purpose since the >>> function ncslpg_destroy() is never called. >>> >>> diff --git a/src/base/hj_hdl.c b/src/base/hj_hdl.c >>> --- a/src/base/hj_hdl.c >>> +++ b/src/base/hj_hdl.c >>> @@ -1,6 +1,7 @@ >>> /* -*- OpenSAF -*- >>>* >>>* (C) Copyright 2008 The OpenSAF Foundation >>> + * Copyright Ericsson AB 2012, 2017 - All Rights Reserved. >>>* >>>* This program is distributed in the hope that it will be useful, but >>>* WITHOUT ANY WARRANTY; without even the implied warranty of >>> MERCHANTABILITY >>> @@ -25,15 +26,6 @@ >>> See ncs_hdl.h for brief write-up of issues/capabilities. See the >>> ncshm_ calls. >>> >>> - This file also contains an implementation for a 'Local Persistence >>> Guard', >>> - which is a cheap (in CPU cycles) persistence guard scheme (for read >>> - only object access, like the handle manager) that can be used when an >>> object >>> - that is known to exist needs a guard for some object that hangs off of >>> this >>> - object. For example, the LEAP sysfpool has a global struct that always >>> exists. >>> - What we need to know and be assured of is that when we access memory, >>> that >>> - the structures managed will persist (destroy() could be called after all) >>> - while we are in the middle of an operation. See the ncslpg_ calls. >>> - >>> >>> ** >>> */ >>> >>> @@ -718,89 +710,3 @@ void hm_unblock_him(HM_CELL *cell) >>> int rc = sem_post((sem_t*)cell->data); /* unblock that destroy thread >>> */ >>> osafassert(rc == 0); >>> } >>> - >>> -/*** >>> - * >>> - * >>> - * >>> - * P u b l i cL o c a l P e r s i s t e n c e G u a r d >>> - * >>> - * A P I s (prefix 'ncslpg_') >>> - * >>> - * >>> - * >>> - >>> ***/ >>> - >>> -/* >>> - >>> - PROCEDURE NAME: ncslpg_take >>> - >>&g
Re: [devel] [PATCH 1 of 1] base: avoid SIGPIPE in osaf_auth_server_connect() [#2286]
Ack. Thanks, Ramesh. On 2/2/2017 8:50 PM, Anders Widell wrote: > Ack. > > regards, > > Anders Widell > > > On 02/02/2017 06:19 AM, Gary Lee wrote: >> src/base/osaf_secutil.c | 2 +- >> 1 files changed, 1 insertions(+), 1 deletions(-) >> >> >> diff --git a/src/base/osaf_secutil.c b/src/base/osaf_secutil.c >> --- a/src/base/osaf_secutil.c >> +++ b/src/base/osaf_secutil.c >> @@ -317,7 +317,7 @@ int osaf_auth_server_connect(const char >> goto done; >> } >> -if (send(sock_fd, req_buf, req_size, 0) == -1) { >> +if (send(sock_fd, req_buf, req_size, MSG_NOSIGNAL) == -1) { >> TRACE_3("send failed - %s", strerror(errno)); >> len = -errno; >> goto done; > -- 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 of 1] nid: Do not require tipc-config to be present when not managing TIPC [#2281]
Ack. Thanks, Ramesh. On 1/31/2017 5:32 PM, Anders Widell wrote: > src/nid/opensafd.in | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > > Skip the check for the tipc-config tool when OPENSAF_MANAGE_TIPC is not set to > "yes" in nid.conf. > > diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in > --- a/src/nid/opensafd.in > +++ b/src/nid/opensafd.in > @@ -60,7 +60,7 @@ unload_tipc() { > > check_tipc() { > # Exit if tipc-config is not installed > - if [ ! -x /sbin/tipc-config ]; then > + if [ "$MANAGE_TIPC" = "yes" ] && [ ! -x /sbin/tipc-config ]; then > which tipc-config >/dev/null 2>&1 > if [ $? -eq 1 ] ; then > logger -s -t $osafprog "Can't find tipc-config in the > PATH, exiting." -- 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 of 1] build: Move libopensaf_core back to libdir and update README [#2298]
Ack. Thanks, Ramesh. On 2/10/2017 7:35 PM, Anders Widell wrote: > Makefile.am | 3 ++- > README | 12 ++-- > opensaf.spec.in | 2 +- > samples/Makefile.common | 1 + > src/base/Makefile.am| 3 ++- > tools/cluster_sim_uml/build_uml | 4 ++-- > 6 files changed, 18 insertions(+), 7 deletions(-) > > > An application binary linked with the OpenSAF AIS libraries may fail to load > after upgrading to OpenSAF 5.2. The reason is that libopensaf_core.so.0 has > moved from /usr/local/lib to /usr/local/lib/opensaf. This problem can happen > if > the following two conditions are met: > > * The application was linked without using the -Wl,--as-needed option (and > this >option is not enabled by default by the Linux distribution used when > building >the application binary) > * The directory /usr/local/lib/opensaf is not listed in LD_LIBRARY_PATH or >/etc/ld.so.conf > > This is fixed by: > > * Moving libopensaf_core back to /usr/local/lib > * Updating the documentation to mention that -Wl,--as-needed must to be used >when linking with the OpenSAF libraries, to avoid similar problems in the >future. > > diff --git a/Makefile.am b/Makefile.am > --- a/Makefile.am > +++ b/Makefile.am > @@ -1,6 +1,7 @@ > # -*- OpenSAF -*- > # > # (C) Copyright 2008 The OpenSAF Foundation > +# Copyright Ericsson AB 2009, 2017 - All Rights Reserved. > # > # This program is distributed in the hope that it will be useful, but > # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY > @@ -54,7 +55,7 @@ AM_CPPFLAGS = \ > > AM_CFLAGS = -pipe -std=gnu11 @OSAF_HARDEN_FLAGS@ -Wall -Wformat=2 -Werror > AM_CXXFLAGS = -pipe -std=gnu++11 @OSAF_HARDEN_FLAGS@ -Wall -Wformat=2 > -Werror > -AM_LDFLAGS = @OSAF_HARDEN_FLAGS@ -ldl -lrt -pthread -rdynamic > +AM_LDFLAGS = @OSAF_HARDEN_FLAGS@ -Wl,--as-needed -ldl -lrt -pthread -rdynamic > ACLOCAL_AMFLAGS = -I m4 > OSAF_LIB_FLAGS = > > diff --git a/README b/README > --- a/README > +++ b/README > @@ -824,6 +824,7 @@ installed with the other system `*.pc' f > There are two easy ways to use `pkgconfig'. The first one is to call it > directly > from a `Makefile' and assign its content to make variables e.g.: > > + AMF_LDFLAGS=-Wl,--as-needed > AMF_LIBS=`pkg-config opensaf-amf --libs` > AMF_CFLAGS=`pkg-config opensaf-amf --cflags` > > @@ -837,8 +838,15 @@ It will then provides two special variab > > -- in Makefile.am -- > mumble_CFLAGS = @AMF_CFLAGS@ > + mumble_LDFLAGS = -Wl,--as-needed > mumble_LDADD = @AMF_LIBS@ > > +The --as-needed ld flag is enabled by default on many modern Linux > +distributions, but just to be on the safe side please make sure to add > +-Wl,--as-needed to your LDFLAGS when linking application programs with the > +OpenSAF AIS libraries. Otherwise the resulting binary may not be compatible > with > +other versions of OpenSAF. > + > > How to Configure `OpenSAF' > == > @@ -918,13 +926,13 @@ The `Makefile' looks for installed `SAF > standard system wide locations (e.g. /usr/include/ & /usr/lib/): > > INCLUDES = -I. > -LDFLAGS = -lSaAmf > +LDFLAGS = -Wl,--as-needed -lSaAmf > > If you have `OpenSAF' development packages installed somewhere else, > override > the default values e.g.: > > % make INCLUDES="-I. -I/tmp/usr/local/include" \ > -LDFLAGS="-L/tmp/usr/local/lib -lSaAmf -lopensaf_core" > +LDFLAGS="-Wl,--as-needed -L/tmp/usr/local/lib -lSaAmf -lopensaf_core" > > To run an application you will need a configured `OpenSAF' node running. > > diff --git a/opensaf.spec.in b/opensaf.spec.in > --- a/opensaf.spec.in > +++ b/opensaf.spec.in > @@ -1427,7 +1427,7 @@ fi > %files libs > %defattr(-,root,root) > %dir %{_pkglibdir} > -%{_pkglibdir}/libopensaf_core.so.* > +%{_libdir}/libopensaf_core.so.* > %{_pkglibdir}/libosaf_common.so.* > > %files tools > diff --git a/samples/Makefile.common b/samples/Makefile.common > --- a/samples/Makefile.common > +++ b/samples/Makefile.common > @@ -1,5 +1,6 @@ > AM_CPPFLAGS = $(all_includes) > AM_CFLAGS = -fPIC -Wall > +AM_LDFLAGS = -Wl,--as-needed > #AM_CFLAGS = -fPIC -Wall -Werror > > lsbinitdir = $(initscriptdir) > diff --git a/src/base/Makefile.am b/src/base/Makefile.am > --- a/src/base/Makefile.am > +++ b/src/base/Makefile.am > @@ -1,6 +1,7 @@ > # -*- OpenSAF -*- > # > # (C) Copyright 2016 The OpenSAF Foundation > +# Copyright Ericsson AB 2017 - All Rights Reserved. > # > # This program is distributed in the hope that it will be useful, but > # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY > @@ -14,7 +15,7 @@ > # Author(s): Ericsson AB > # > > -osaf_lib_LTLIBRARIES += lib/libopensaf_core.la > +lib_LTLIBRARIES += lib/libopensaf_core.la > > lib_libopensaf_core_la_CFLAGS = $(
Re: [devel] [PATCH 1 of 1] base: Remove the local persistence guard API [#2275]
Ack. Thanks, Ramesh. On 1/25/2017 5:19 PM, Anders Widell wrote: > The *_hdl() functions are also good candidates for removal. :-) > > The timer destruction utilizes multiple mechanisms for > synchronization: a flag called "tmr_destroying", and a selection > object called tmr_destroy_syn_obj. Presumably, these mechanisms are > enough for synchronizing the destruction of the timer data structures. > > regards, > Anders Widell > > On 01/25/2017 11:56 AM, ramesh betham wrote: >> Hi Anders, >> >> Across OpenSAF code, ncshm_<...>_hdl() functions are serving the >> similar purpose. >> >> The reason for not noticing inconsistency in handling ncslpg_<> >> functions in sysf_tmr can be due to >> >> 1. Threads that are using timer calls are gracefully exited before >> the main thread exits (or) >> 2. The protection taken by applications through ncshm_<>_hdl() >> functions had made threads to exit in graceful manner. (or) >> 3. Main thread exiting and subsequently the respective process >> exiting might have hided the situation of thread status that is >> still live and processing sysf_tmr calls. >> >> Regards, >> Ramesh. >> >> >> On 1/25/2017 2:35 PM, Anders Widell wrote: >>> >>> Let't not become sentimental about old broke code. As noted, this >>> mechanism is currently broken and doesn't do anything useful in its >>> current form. I doubt that it has ever worked during the history of >>> the OpenSAF project. And if it was really needed, it is doubtful why >>> it would only be needed in the timer implementation and not anywhere >>> else. >>> >>> regards, >>> >>> Anders Widell >>> >>> >>> On 01/25/2017 05:22 AM, ramesh betham wrote: >>>> Hi Anders, >>>> >>>> Quick comments. >>>> >>>> The purpose of having ncslpg_<...>() functions in sysf_tmr is >>>> to make sure to go through gracefull shutdown process. >>>> sysfTmrDestroy() is suppose to wait till all threads using >>>> sysfTmr to complete their tasks. Observed that ncslpg_destroy() >>>> should have been called in sysfTmrDestroy() to accomplish the >>>> defined purpose. >>>> >>>> Regards, >>>> Ramesh. >>>> >>>> On 1/24/2017 7:24 PM, Anders Widell wrote: >>>>> src/base/hj_hdl.c | 96 >>>>> +- >>>>> src/base/ncs_hdl_pub.h | 22 +-- >>>>> src/base/sysf_tmr.c| 34 ++--- >>>>> 3 files changed, 6 insertions(+), 146 deletions(-) >>>>> >>>>> >>>>> Remove the "local persistence guard" API since it is only referenced by >>>>> the >>>>> OpenSAF timer implementation, and in there it servces no purpose since the >>>>> function ncslpg_destroy() is never called. >>>>> >>>>> diff --git a/src/base/hj_hdl.c b/src/base/hj_hdl.c >>>>> --- a/src/base/hj_hdl.c >>>>> +++ b/src/base/hj_hdl.c >>>>> @@ -1,6 +1,7 @@ >>>>> /* -*- OpenSAF -*- >>>>>* >>>>>* (C) Copyright 2008 The OpenSAF Foundation >>>>> + * Copyright Ericsson AB 2012, 2017 - All Rights Reserved. >>>>>* >>>>>* This program is distributed in the hope that it will be useful, but >>>>>* WITHOUT ANY WARRANTY; without even the implied warranty of >>>>> MERCHANTABILITY >>>>> @@ -25,15 +26,6 @@ >>>>> See ncs_hdl.h for brief write-up of issues/capabilities. See the >>>>> ncshm_ calls. >>>>> >>>>> - This file also contains an implementation for a 'Local Persistence >>>>> Guard', >>>>> - which is a cheap (in CPU cycles) persistence guard scheme (for read >>>>> - only object access, like the handle manager) that can be used when an >>>>> object >>>>> - that is known to exist needs a guard for some object that hangs off of >>>>> this >>>>> - object. For example, the LEAP sysfpool has a global struct that always >>>>> exists. >>>>> - What we need to know and be assured of is that when we access memory, >>>>> that >>>>> - the structures manag
[devel] [PATCH 1 of 1] osaf:fm on new-Active handling amfd up event of peer old-Active node which is going down[#2151]
src/fm/fmd/fm_cb.h |3 + src/fm/fmd/fm_evt.h |2 +- src/fm/fmd/fm_main.c | 114 +--- src/fm/fmd/fm_mds.c | 173 +++--- 4 files changed, 186 insertions(+), 106 deletions(-) This patch addresses the specific scenario where the new Active is coming up and has discovered the afmd process on the peer node (which is going down) is still alive. Here the peer amfd/amfnd is still in the process of going down i.e., progressing in termination of application components having big timeouts etc. diff --git a/src/fm/fmd/fm_cb.h b/src/fm/fmd/fm_cb.h --- a/src/fm/fmd/fm_cb.h +++ b/src/fm/fmd/fm_cb.h @@ -1,6 +1,7 @@ /* -*- OpenSAF -*- * * (C) Copyright 2008 The OpenSAF Foundation +* Copyright (C) 2017, Oracle and/or its affiliates. All rights reserved. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -107,6 +108,8 @@ typedef struct fm_cb { bool use_remote_fencing; SaNameT peer_clm_node_name; bool peer_node_terminated; + NCS_SEL_OBJ peer_down_obj; + int peer_down_await; } FM_CB; extern char *role_string[]; diff --git a/src/fm/fmd/fm_evt.h b/src/fm/fmd/fm_evt.h --- a/src/fm/fmd/fm_evt.h +++ b/src/fm/fmd/fm_evt.h @@ -1,6 +1,7 @@ /* -*- OpenSAF -*- * * (C) Copyright 2008 The OpenSAF Foundation +* Copyright (C) 2017, Oracle and/or its affiliates. All rights reserved. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -49,7 +50,6 @@ typedef enum { FM_EVT_NODE_DOWN, FM_EVT_PEER_UP, FM_EVT_RDA_ROLE, - FM_EVT_SVC_DOWN, FM_FSM_EVT_MAX } FM_FSM_EVT_CODE; diff --git a/src/fm/fmd/fm_main.c b/src/fm/fmd/fm_main.c --- a/src/fm/fmd/fm_main.c +++ b/src/fm/fmd/fm_main.c @@ -1,6 +1,7 @@ /* -*- OpenSAF -*- * * (C) Copyright 2008 The OpenSAF Foundation +* Copyright (C) 2017, Oracle and/or its affiliates. All rights reserved. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -31,6 +32,7 @@ This file contains the main() routine fo #include "nid/agent/nid_api.h" #include "fm.h" #include "base/osaf_time.h" +#include "base/osaf_poll.h" #define FM_CLM_API_TIMEOUT 100LL @@ -71,7 +73,6 @@ void handle_mbx_event(void); extern uint32_t fm_amf_init(FM_AMF_CB *fm_amf_cb); uint32_t gl_fm_hdl; static NCS_SEL_OBJ usr1_sel_obj; -void fm_proc_svc_down(FM_CB *cb, FM_EVT *fm_mbx_evt); /** * USR1 signal is used when AMF wants instantiate us as a @@ -119,6 +120,40 @@ static void rda_cb(uint32_t cb_hdl, PCS_ TRACE_LEAVE(); } +/* This function primarily handles the weird situation in a cluster where the controller + * node which is coming up identifies the peer node is in the midst of DOWN process (i.e., + * non-existance of peer FM and amfd/amfnd is still alive). In this case, the controller + * node has to wait till the peer gracefully shutdowns. This function returns FAILURE if + * peer controller node is not down in a timeout period of OPENSAF_TERMTIMEOUT (or 60 secs default). + */ +static uint32_tfm_peer_down_wait(FM_CB *fm_cb) +{ + char *envVar = NULL; + int peer_term_timeout = 60; /*default 60 secs */ + + TRACE_ENTER(); + + /* Hoping that "OPENSAF_TERMTIMEOUT" on both the controllers shall be the same */ + if ((envVar = getenv("OPENSAF_TERMTIMEOUT"))) + peer_term_timeout = atoi(envVar); + + m_NCS_SEL_OBJ_CREATE(&fm_cb->peer_down_obj); + fm_cb->peer_down_await = 1; + +osaf_poll_one_fd(m_GET_FD_FROM_SEL_OBJ(fm_cb->peer_down_obj), peer_term_timeout*1000); + + m_NCS_SEL_OBJ_DESTROY(&fm_cb->peer_down_obj); + + /* Return failure if peer node is not yet completely down */ + if(fm_cb->peer_down_await) { + LOG_ER("Peer node is not fully DOWN, please check"); + TRACE_LEAVE(); + return NCSCC_RC_FAILURE; + } + + TRACE_LEAVE(); + return NCSCC_RC_SUCCESS; +} /* @@ -176,6 +211,11 @@ int main(int argc, char *argv[]) */ fm_cb->control_tipc = true; /* Default behaviour */ + fm_cb->immd_down = true; + fm_cb->immnd_down = true; + fm_cb->amfnd_down = true; + fm_cb->amfd_down = true; + /* Create CB handle */ gl_fm_hdl = ncshm_create_hdl(NCS_HM_POOL_ID_COMMON, NCS_SERVICE_ID_GFM, (NCSCONTEXT)fm_cb); @@ -194,7 +234,7 @@ int main(int argc, char *argv[]) goto fm_init_failed; } -/* Attach MBX */ + /* Attach MBX */ if (m_NCS_IPC_ATTACH(&fm_cb->mbx) != NCSCC_RC_SUCCESS) { syslog(
[devel] [PATCH 0 of 1] Review Request for osaf:fm on new-Active handling amfd up event of peer old-Active node which is going down[#2151]
Summary:osaf:fm on new-Active handling amfd up event of peer old-Active node which is going down[#2151] Review request for Trac Ticket(s):2151 Peer Reviewer(s):Praveen, Nagendra and Anders Affected branch(es): default Development branch: default Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesy OpenSAF servicesn Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - changeset 9550aeae217714f50496e7e081299b73a46ee2df Author: Ramesh Betham Date: Wed, 22 Feb 2017 16:54:24 +0530 osaf:fm on new-Active handling amfd up event of peer old-Active node which is going down[#2151] This patch addresses the specific scenario where the new Active is coming up and has discovered the afmd process on the peer node (which is going down) is still alive. Here the peer amfd/amfnd is still in the process of going down i.e., progressing in termination of application components having big timeouts etc. Complete diffstat: -- src/fm/fmd/fm_cb.h |3 +++ src/fm/fmd/fm_evt.h |2 +- src/fm/fmd/fm_main.c | 114 -- src/fm/fmd/fm_mds.c | 173 ++--- 4 files changed, 186 insertions(+), 106 deletions(-) Testing Commands: - 1. Verify as per the reproducible steps mentioned in Ticket(#2151) description. 2. Verify switch-overs and failovers. Testing, Expected Results: -- Once fm on new-Active detects amfd process is still alive on the peer node which is going down (and no peer FM exist) issues a local-reboot by logging appropriate message for admin to check. Regular switchovers and failovers should pass. Conditions of Submission: - Ack from Reviewers Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.hgrc file (i.e. username, email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that update
Re: [devel] [PATCH 1 of 1] base: Add a collision-resistant hash function [#2266]
Hi, Ack on top of Zoran comments. *Few comments:* Understands that this implementation is aligning to the IETF standards defined in RFC 4648 , 6234 etc. and there are similar implementations exist too. Probably you may need to update the files with right justification such that the code matches (when verified through code-scan tools) shall not create conflicts with any other source-code licensing rights etc. Not able to correlate how LOG svc has requirement of these hash definitions. May be I need to understand #2258 enhancement. Thanks, Ramesh. On 2/21/2017 6:01 PM, Zoran Milinkovic wrote: > Hi Anders, > > I have few comments to the patch > > The hash function will not work on big endian systems. > Do we support only little endian systems or OpenSAF code should work on both > endian systems ? > > Base64 has only encoding function. > If something is going to be pushed to base directory, then I think is better > to have full implementation, so that it can be used by other OpenSAF code, > and not only for LOG. > > If the hash is for general purposes, then it should not be encoded by base64 > at the end. Array of bytes should be returned from the hash. If it's needed, > base64 can be done later on the returned array of bytes. > > BR, > Zoran > > -Original Message- > From: Anders Widell [mailto:anders.wid...@ericsson.com] > Sent: den 21 februari 2017 11:45 > To: ramesh.bet...@oracle.com > Cc: opensaf-devel@lists.sourceforge.net > Subject: [devel] [PATCH 1 of 1] base: Add a collision-resistant hash function > [#2266] > > src/base/Makefile.am| 16 +- > src/base/hash.cc| 239 > > src/base/hash.h | 32 + > src/base/tests/hash_test.cc | 109 > 4 files changed, 390 insertions(+), 6 deletions(-) > > > Add a function that returns a 32 character string which is generated by > computing the SHA-512/192 hash of the message parameter, and encoding the > result > using Base64 with a URL and filename safe alphabet. For more information about > these algorithms, refer to the corresponding standards. SHA-512/192 is defined > in FIPS 180-4. Base64 is defined in RFC 4648. > > diff --git a/src/base/Makefile.am b/src/base/Makefile.am > --- a/src/base/Makefile.am > +++ b/src/base/Makefile.am > @@ -35,6 +35,7 @@ lib_libopensaf_core_la_SOURCES += \ > src/base/daemon.c \ > src/base/file_notify.cc \ > src/base/getenv.cc \ > + src/base/hash.cc \ > src/base/hj_dec.c \ > src/base/hj_edp.c \ > src/base/hj_edu.c \ > @@ -79,6 +80,7 @@ noinst_HEADERS += \ > src/base/daemon.h \ > src/base/file_notify.h \ > src/base/getenv.h \ > + src/base/hash.h \ > src/base/log_message.h \ > src/base/logtrace.h \ > src/base/macros.h \ > @@ -176,16 +178,18 @@ bin_libbase_test_CPPFLAGS = \ > > bin_libbase_test_LDFLAGS = \ > $(AM_LDFLAGS) \ > - src/base/lib_libopensaf_core_la-unix_socket.lo \ > - src/base/lib_libopensaf_core_la-unix_server_socket.lo \ > + src/base/lib_libopensaf_core_la-file_notify.lo \ > src/base/lib_libopensaf_core_la-getenv.lo \ > + src/base/lib_libopensaf_core_la-hash.lo \ > src/base/lib_libopensaf_core_la-log_message.lo \ > src/base/lib_libopensaf_core_la-process.lo \ > - src/base/lib_libopensaf_core_la-file_notify.lo > + src/base/lib_libopensaf_core_la-unix_server_socket.lo \ > + src/base/lib_libopensaf_core_la-unix_socket.lo > > bin_libbase_test_SOURCES = \ > - src/base/tests/unix_socket_test.cc \ > + src/base/tests/file_notify_test.cc \ > src/base/tests/getenv_test.cc \ > + src/base/tests/hash_test.cc \ > src/base/tests/log_message_test.cc \ > src/base/tests/mock_logtrace.cc \ > src/base/tests/mock_osaf_abort.cc \ > @@ -193,8 +197,8 @@ bin_libbase_test_SOURCES = \ > src/base/tests/time_add_test.cc \ > src/base/tests/time_compare_test.cc \ > src/base/tests/time_convert_test.cc \ > - src/base/tests/file_notify_test.cc \ > - src/base/tests/time_subtract_test.cc > + src/base/tests/time_subtract_test.cc \ > + src/base/tests/unix_socket_test.cc > > bin_libbase_test_LDADD = \ > $(GTEST_DIR)/lib/libgtest.la \ > diff --git a/src/base/hash.cc b/src/base/hash.cc > new file mode 100644 > --- /dev/null > +++ b/src/base/hash.cc > @@ -0,0 +1,239 @@ > +/* -*- OpenSAF -*- > + * > + * Copyright Ericsson AB 2017 - All Rights Reserved. > + * > + * This program is distributed in the hope that it will be useful, but > + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY > + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed > + * under the GNU Lesser General Public License Version 2.1, February 1999. > + * The complete license can be accessed from the following location: > + * http://opensource.org/licenses/lgpl-license
Re: [devel] [PATCH 1 of 1] base: Remove existing socket before creating a new one [#2293]
Ack. Thanks, Ramesh. On 2/10/2017 7:59 PM, Anders Widell wrote: > src/base/Makefile.am | 3 + > src/base/file_descriptor.cc| 27 + > src/base/file_descriptor.h | 27 + > src/base/tests/unix_socket_test.cc | 60 > + > src/base/unix_client_socket.cc | 10 +- > src/base/unix_server_socket.cc | 12 ++- > src/base/unix_socket.cc| 32 +-- > src/base/unix_socket.h | 49 -- > 8 files changed, 177 insertions(+), 43 deletions(-) > > > Multiple issues have been fixed in the UnixSocket class: > > * The UnixServerSocket failed if the named already exists in the file system. > * The UnixSocket used a mutex to protect Open() and Close(), but was is not >enough to make it thread safe. The mutex has been removed and users are now >responsible for protecting the instance if needed. > * The fd() method was not so useful since it required a message to be sent or >received before it returned a valid file descriptor. The fd() method now > opens >the socket if it is not already open. > * The UnixClientSocket implemented a wait-loop in case connect() returns >EINPROGRESS. This has been changed to use a blocking call to connect() >instead. > > diff --git a/src/base/Makefile.am b/src/base/Makefile.am > --- a/src/base/Makefile.am > +++ b/src/base/Makefile.am > @@ -32,6 +32,7 @@ lib_libopensaf_core_la_LDFLAGS += \ > lib_libopensaf_core_la_SOURCES += \ > src/base/condition_variable.cc \ > src/base/daemon.c \ > + src/base/file_descriptor.cc \ > src/base/file_notify.cc \ > src/base/getenv.cc \ > src/base/hj_dec.c \ > @@ -76,6 +77,7 @@ noinst_HEADERS += \ > src/base/buffer.h \ > src/base/condition_variable.h \ > src/base/daemon.h \ > + src/base/file_descriptor.h \ > src/base/file_notify.h \ > src/base/getenv.h \ > src/base/log_message.h \ > @@ -180,6 +182,7 @@ bin_libbase_test_LDFLAGS = \ > src/base/lib_libopensaf_core_la-getenv.lo \ > src/base/lib_libopensaf_core_la-log_message.lo \ > src/base/lib_libopensaf_core_la-process.lo \ > + src/base/lib_libopensaf_core_la-file_descriptor.lo \ > src/base/lib_libopensaf_core_la-file_notify.lo > > bin_libbase_test_SOURCES = \ > diff --git a/src/base/file_descriptor.cc b/src/base/file_descriptor.cc > new file mode 100644 > --- /dev/null > +++ b/src/base/file_descriptor.cc > @@ -0,0 +1,27 @@ > +/* -*- OpenSAF -*- > + * > + * Copyright Ericsson AB 2017 - All Rights Reserved. > + * > + * This program is distributed in the hope that it will be useful, but > + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY > + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed > + * under the GNU Lesser General Public License Version 2.1, February 1999. > + * The complete license can be accessed from the following location: > + * http://opensource.org/licenses/lgpl-license.php > + * See the Copying file included with the OpenSAF distribution for full > + * licensing terms. > + * > + */ > + > +#include "base/file_descriptor.h" > +#include > +#include > + > +namespace base { > + > +bool MakeFdNonblocking(int fd) { > + int flags = fcntl(fd, F_GETFL); > + return flags != -1 && fcntl(fd, F_SETFL, flags | O_NONBLOCK) != -1; > +} > + > +} // namespace base > diff --git a/src/base/file_descriptor.h b/src/base/file_descriptor.h > new file mode 100644 > --- /dev/null > +++ b/src/base/file_descriptor.h > @@ -0,0 +1,27 @@ > +/* -*- OpenSAF -*- > + * > + * Copyright Ericsson AB 2017 - All Rights Reserved. > + * > + * This program is distributed in the hope that it will be useful, but > + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY > + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed > + * under the GNU Lesser General Public License Version 2.1, February 1999. > + * The complete license can be accessed from the following location: > + * http://opensource.org/licenses/lgpl-license.php > + * See the Copying file included with the OpenSAF distribution for full > + * licensing terms. > + * > + */ > + > +#ifndef BASE_FILE_DESCRIPTOR_H_ > +#define BASE_FILE_DESCRIPTOR_H_ > + > +namespace base { > + > +// Set the a file descriptor's non-blocking flag. Returns true if successful, > +// and false otherwise. > +bool MakeFdNonblocking(int fd); > + > +} // namespace base > + > +#endif // BASE_FILE_DESCRIPTOR_H_ > diff --git a/src/base/tests/unix_socket_test.cc > b/src/base/tests/unix_socket_test.cc > --- a/src/base/tests/unix_socket_test.cc > +++ b/src/base/tests/unix_socket_test.cc > @@ -1,6 +1,7 @@ > /* -*- OpenSAF -*- >* >* (C) Copyright 2016 The OpenSAF Foundation > + * Copyright Ericsson AB 2017 - All Rights Reserved. >* >* This program is distributed in th
Re: [devel] [PATCH 1 of 1] osaf:fm on new-Active handling amfd up event of peer old-Active node which is going down[#2151]
Good catch. Hitting the case of fm_peer_down_wait() is very unlikely. But here fm_peer_down_wait() is called only before fm nid_notifies and considering for amfnd-up event too. A rare and race condition can hit where fm on upcoming new active receives fm-down event and amfnd is still alive. Thanks, Ramesh. On 2/24/2017 2:18 PM, praveen malviya wrote: > Hi Ramesh, > > One minor query: > In RED_UP of peer AVD, newly active SC will reboot itself if peer FM > on old active SC is not up. If this true then in which situations > newly active SC will wait in fm_peer_down_wait(). > > Thanks, > Praveen > > > On 22-Feb-17 5:00 PM, ramesh.bet...@oracle.com wrote: >> src/fm/fmd/fm_cb.h |3 + >> src/fm/fmd/fm_evt.h |2 +- >> src/fm/fmd/fm_main.c | 114 +--- >> src/fm/fmd/fm_mds.c | 173 >> +++--- >> 4 files changed, 186 insertions(+), 106 deletions(-) >> >> >> This patch addresses the specific scenario where the new Active is >> coming up and has discovered the afmd process on the peer node (which >> is going down) is still alive. Here the peer amfd/amfnd is still in >> the process of going down i.e., progressing in termination of >> application components having big timeouts etc. >> >> diff --git a/src/fm/fmd/fm_cb.h b/src/fm/fmd/fm_cb.h >> --- a/src/fm/fmd/fm_cb.h >> +++ b/src/fm/fmd/fm_cb.h >> @@ -1,6 +1,7 @@ >> /* -*- OpenSAF -*- >> * >> * (C) Copyright 2008 The OpenSAF Foundation >> +* Copyright (C) 2017, Oracle and/or its affiliates. All rights >> reserved. >> * >> * This program is distributed in the hope that it will be useful, but >> * WITHOUT ANY WARRANTY; without even the implied warranty of >> MERCHANTABILITY >> @@ -107,6 +108,8 @@ typedef struct fm_cb { >> bool use_remote_fencing; >> SaNameT peer_clm_node_name; >> bool peer_node_terminated; >> +NCS_SEL_OBJ peer_down_obj; >> +int peer_down_await; >> } FM_CB; >> >> extern char *role_string[]; >> diff --git a/src/fm/fmd/fm_evt.h b/src/fm/fmd/fm_evt.h >> --- a/src/fm/fmd/fm_evt.h >> +++ b/src/fm/fmd/fm_evt.h >> @@ -1,6 +1,7 @@ >> /* -*- OpenSAF -*- >> * >> * (C) Copyright 2008 The OpenSAF Foundation >> +* Copyright (C) 2017, Oracle and/or its affiliates. All rights >> reserved. >> * >> * This program is distributed in the hope that it will be useful, but >> * WITHOUT ANY WARRANTY; without even the implied warranty of >> MERCHANTABILITY >> @@ -49,7 +50,6 @@ typedef enum { >> FM_EVT_NODE_DOWN, >> FM_EVT_PEER_UP, >> FM_EVT_RDA_ROLE, >> -FM_EVT_SVC_DOWN, >> FM_FSM_EVT_MAX >> } FM_FSM_EVT_CODE; >> >> diff --git a/src/fm/fmd/fm_main.c b/src/fm/fmd/fm_main.c >> --- a/src/fm/fmd/fm_main.c >> +++ b/src/fm/fmd/fm_main.c >> @@ -1,6 +1,7 @@ >> /* -*- OpenSAF -*- >> * >> * (C) Copyright 2008 The OpenSAF Foundation >> +* Copyright (C) 2017, Oracle and/or its affiliates. All rights >> reserved. >> * >> * This program is distributed in the hope that it will be useful, but >> * WITHOUT ANY WARRANTY; without even the implied warranty of >> MERCHANTABILITY >> @@ -31,6 +32,7 @@ This file contains the main() routine fo >> #include "nid/agent/nid_api.h" >> #include "fm.h" >> #include "base/osaf_time.h" >> +#include "base/osaf_poll.h" >> >> #define FM_CLM_API_TIMEOUT 100LL >> >> @@ -71,7 +73,6 @@ void handle_mbx_event(void); >> extern uint32_t fm_amf_init(FM_AMF_CB *fm_amf_cb); >> uint32_t gl_fm_hdl; >> static NCS_SEL_OBJ usr1_sel_obj; >> -void fm_proc_svc_down(FM_CB *cb, FM_EVT *fm_mbx_evt); >> >> /** >> * USR1 signal is used when AMF wants instantiate us as a >> @@ -119,6 +120,40 @@ static void rda_cb(uint32_t cb_hdl, PCS_ >> TRACE_LEAVE(); >> } >> >> +/* This function primarily handles the weird situation in a cluster >> where the controller >> + * node which is coming up identifies the peer node is in the midst >> of DOWN process (i.e., >> + * non-existance of peer FM and amfd/amfnd is still alive). In this >> case, the controller >> + * node has to wait till the peer gracefully shutdowns. This >> function returns FAILURE if >> + * peer controller node is not down in a timeout period of >> OPENSAF_TERMTIMEOUT (or 60 secs default). >> + */ >> +static uint32_tfm_peer_down_wait(FM_CB *fm_cb) >> +{ >> +char *envVar = NULL; >> +int peer_term_timeout = 60; /*default 60 secs */ >> + >> +TRACE_ENTER(); >> + >> +/* Hoping that "OPENSAF_TERMTIMEOUT" on both the controllers >> shall be the same */ >> +if ((envVar = getenv("OPENSAF_TERMTIMEOUT"))) >> +peer_term_timeout = atoi(envVar); >> + >> +m_NCS_SEL_OBJ_CREATE(&fm_cb->peer_down_obj); >> +fm_cb->peer_down_await = 1; >> + >> + osaf_poll_one_fd(m_GET_FD_FROM_SEL_OBJ(fm_cb->peer_down_obj), >> peer_term_timeout*1000); >> + >> +m_NCS_SEL_OBJ_DESTROY(&fm_cb->peer_down_obj); >> + >> +/* Return failure if peer node is not yet completely down */ >> +if(fm_cb->peer_down_await)
Re: [devel] [PATCH 1 of 1] osaf:fm on new-Active handling amfd up event of peer old-Active node which is going down[#2151]
I don't think RED_UP always come first or later MDS_UP or vice-versa. Most likley it depends on the sequence of svc registrations happens with MDS. Thanks, Ramesh. On 2/24/2017 4:48 PM, praveen malviya wrote: > > > On 24-Feb-17 4:07 PM, ramesh betham wrote: >> Good catch. Hitting the case of fm_peer_down_wait() is very unlikely. >> >> But here fm_peer_down_wait() is called only before fm nid_notifies and >> considering for amfnd-up event too. A rare and race condition can hit >> where fm on upcoming new active receives fm-down event and amfnd is >> still alive. >> > But the if block where cb->amfnd_down is marked false assumes that > cb->peer_node_id is already set in RED_UP events of IMMD or AVD. Is > there any guarantee from MDS that RED_UP event will always come before > normal MDS_UP event? > > Thanks, > Praveen > >> Thanks, >> Ramesh. >> >> On 2/24/2017 2:18 PM, praveen malviya wrote: >>> Hi Ramesh, >>> >>> One minor query: >>> In RED_UP of peer AVD, newly active SC will reboot itself if peer FM >>> on old active SC is not up. If this true then in which situations >>> newly active SC will wait in fm_peer_down_wait(). >>> >>> Thanks, >>> Praveen >>> >>> >>> On 22-Feb-17 5:00 PM, ramesh.bet...@oracle.com wrote: >>>> src/fm/fmd/fm_cb.h |3 + >>>> src/fm/fmd/fm_evt.h |2 +- >>>> src/fm/fmd/fm_main.c | 114 +--- >>>> src/fm/fmd/fm_mds.c | 173 >>>> +++--- >>>> 4 files changed, 186 insertions(+), 106 deletions(-) >>>> >>>> >>>> This patch addresses the specific scenario where the new Active is >>>> coming up and has discovered the afmd process on the peer node (which >>>> is going down) is still alive. Here the peer amfd/amfnd is still in >>>> the process of going down i.e., progressing in termination of >>>> application components having big timeouts etc. >>>> >>>> diff --git a/src/fm/fmd/fm_cb.h b/src/fm/fmd/fm_cb.h >>>> --- a/src/fm/fmd/fm_cb.h >>>> +++ b/src/fm/fmd/fm_cb.h >>>> @@ -1,6 +1,7 @@ >>>> /* -*- OpenSAF -*- >>>> * >>>> * (C) Copyright 2008 The OpenSAF Foundation >>>> +* Copyright (C) 2017, Oracle and/or its affiliates. All rights >>>> reserved. >>>> * >>>> * This program is distributed in the hope that it will be useful, but >>>> * WITHOUT ANY WARRANTY; without even the implied warranty of >>>> MERCHANTABILITY >>>> @@ -107,6 +108,8 @@ typedef struct fm_cb { >>>> bool use_remote_fencing; >>>> SaNameT peer_clm_node_name; >>>> bool peer_node_terminated; >>>> +NCS_SEL_OBJ peer_down_obj; >>>> +int peer_down_await; >>>> } FM_CB; >>>> >>>> extern char *role_string[]; >>>> diff --git a/src/fm/fmd/fm_evt.h b/src/fm/fmd/fm_evt.h >>>> --- a/src/fm/fmd/fm_evt.h >>>> +++ b/src/fm/fmd/fm_evt.h >>>> @@ -1,6 +1,7 @@ >>>> /* -*- OpenSAF -*- >>>> * >>>> * (C) Copyright 2008 The OpenSAF Foundation >>>> +* Copyright (C) 2017, Oracle and/or its affiliates. All rights >>>> reserved. >>>> * >>>> * This program is distributed in the hope that it will be useful, but >>>> * WITHOUT ANY WARRANTY; without even the implied warranty of >>>> MERCHANTABILITY >>>> @@ -49,7 +50,6 @@ typedef enum { >>>> FM_EVT_NODE_DOWN, >>>> FM_EVT_PEER_UP, >>>> FM_EVT_RDA_ROLE, >>>> -FM_EVT_SVC_DOWN, >>>> FM_FSM_EVT_MAX >>>> } FM_FSM_EVT_CODE; >>>> >>>> diff --git a/src/fm/fmd/fm_main.c b/src/fm/fmd/fm_main.c >>>> --- a/src/fm/fmd/fm_main.c >>>> +++ b/src/fm/fmd/fm_main.c >>>> @@ -1,6 +1,7 @@ >>>> /* -*- OpenSAF -*- >>>> * >>>> * (C) Copyright 2008 The OpenSAF Foundation >>>> +* Copyright (C) 2017, Oracle and/or its affiliates. All rights >>>> reserved. >>>> * >>>> * This program is distributed in the hope that it will be useful, but >>>> * WITHOUT ANY WARRANTY; without even the implied warranty of >>>> MERCHANTABILITY >>>> @@ -31,6 +32,7 @@ This file contains the main() routine fo >>>> #include &qu
Re: [devel] [PATCH 1 of 2] base: Add methods for reading the FQDN, host name and node name [#2267]
Ack. With minor comment. Divide the following if() condition to accommodate to check the return values of getnameinfo() and to have a TRACE to print the host name etc. + if (addr != nullptr && + (addr->sa_family == AF_INET || addr->sa_family == AF_INET6) && + (i->ifa_flags & IFF_LOOPBACK) == 0 && + (i->ifa_flags & IFF_UP) != 0 && + (addr->sa_family != AF_INET6 || + (!IN6_IS_ADDR_LOOPBACK(&addr_ipv6->sin6_addr) && +!IN6_IS_ADDR_LINKLOCAL(&addr_ipv6->sin6_addr) && +!IN6_IS_ADDR_MC_LINKLOCAL(&addr_ipv6->sin6_addr))) && + getnameinfo(addr, addr->sa_family == AF_INET6 ? + sizeof(sockaddr_in6) : sizeof(sockaddr_in), + host, sizeof(host), nullptr, 0, 0) == 0 && + strncmp(short_host_name.c_str(), host, short_host_name.size()) == 0 && + host[short_host_name.size()] == '.') { +fqdn = host; Thanks, Ramesh. On 2/17/2017 3:03 PM, Anders Widell wrote: > src/base/Makefile.am |2 + > src/base/conf.cc | 152 > +++ > src/base/conf.h | 106 +++ > 3 files changed, 260 insertions(+), 0 deletions(-) > > > Add a new class called Conf the contains methods for reading the fully > qualified > domain name, the short host name and the configured OpenSAF node name. > > diff --git a/src/base/Makefile.am b/src/base/Makefile.am > --- a/src/base/Makefile.am > +++ b/src/base/Makefile.am > @@ -32,6 +32,7 @@ lib_libopensaf_core_la_LDFLAGS += \ > > lib_libopensaf_core_la_SOURCES += \ > src/base/condition_variable.cc \ > + src/base/conf.cc \ > src/base/daemon.c \ > src/base/file_descriptor.cc \ > src/base/file_notify.cc \ > @@ -77,6 +78,7 @@ nodist_EXTRA_lib_libopensaf_core_la_SOUR > noinst_HEADERS += \ > src/base/buffer.h \ > src/base/condition_variable.h \ > + src/base/conf.h \ > src/base/daemon.h \ > src/base/file_descriptor.h \ > src/base/file_notify.h \ > diff --git a/src/base/conf.cc b/src/base/conf.cc > new file mode 100644 > --- /dev/null > +++ b/src/base/conf.cc > @@ -0,0 +1,152 @@ > +/* -*- OpenSAF -*- > + * > + * Copyright Ericsson AB 2017 - All Rights Reserved. > + * > + * This program is distributed in the hope that it will be useful, but > + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY > + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed > + * under the GNU Lesser General Public License Version 2.1, February 1999. > + * The complete license can be accessed from the following location: > + * http://opensource.org/licenses/lgpl-license.php > + * See the Copying file included with the OpenSAF distribution for full > + * licensing terms. > + * > + */ > + > +#include "base/conf.h" > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include "base/logtrace.h" > +#include "base/osaf_utility.h" > +#include "osaf/configmake.h" > + > +namespace base { > + > +pthread_once_t Conf::once_control_ = PTHREAD_ONCE_INIT; > +Conf* Conf::instance_ = nullptr; > + > +Conf::Conf() : > +fully_qualified_domain_name_{}, > +node_name_{}, > +short_host_name_{}, > +fully_qualified_domain_name_initialized_{false}, > +node_name_initialized_{false}, > +short_host_name_initialized_{false}, > +mutex_{} { > +} > + > +Conf::~Conf() { > + Lock lock(instance_->mutex_); > + assert(instance_ == this); > + instance_ = nullptr; > +} > + > +void Conf::InitFullyQualifiedDomainName() { > + InitShortHostName(); > + Conf* i = GetOrCreateInstance(); > + Lock lock(i->mutex_); > + if (i->fully_qualified_domain_name_initialized_ == false) { > +i->fully_qualified_domain_name_ = > +GetFullyQualifiedDomainName(i->short_host_name_); > +i->fully_qualified_domain_name_initialized_ = true; > + } > +} > + > +void Conf::InitNodeName() { > + InitShortHostName(); > + Conf* i = GetOrCreateInstance(); > + Lock lock(i->mutex_); > + if (i->node_name_initialized_ == false) { > +i->node_name_ = GetNodeName(i->short_host_name_); > +i->node_name_initialized_ = true; > + } > +} > + > +void Conf::InitShortHostName() { > + Conf* i = GetOrCreateInstance(); > + Lock lock(i->mutex_); > + if (i->short_host_name_initialized_ == false) { > +i->short_host_name_ = GetShortHostName(); > +i->short_host_name_initialized_ = true; > + } > +} > + > +Conf* Conf::GetOrCreateInstance() { > + int result = pthread_once(&once_control_, PthreadOnceInitRoutine); > + if (result != 0) osaf_abort(result); > + return instance_; > +} > + > +void Conf::PthreadOnceInitRoutine() { > + assert(instance_ == nullptr); > + instance_ = new Conf(); > + if (instance_ == nullptr) osaf_abort(0); > +} > + > +std::string Conf::GetFullyQualifiedDomainName( > +const std::string& sho
Re: [devel] Fwd: [PATCH 1 of 1] base: Add a collision-resistant hash function [#2266]
Ack. Some how the original mail from Anders was not landed in my mail box. Thanks, Ramesh. On 2/28/2017 3:07 PM, A V Mahesh wrote: > > > > Forwarded Message > Subject: [devel] [PATCH 1 of 1] base: Add a collision-resistant > hash function [#2266] > Date: Fri, 24 Feb 2017 15:26:55 +0100 > From: Anders Widell > To: ramesh.bet...@oracle.com > CC: opensaf-devel@lists.sourceforge.net > > > > README |2 + > src/base/Makefile.am| 17 -- > src/base/hash.cc| 28 +++ > src/base/hash.h | 67 +++ > src/base/tests/hash_test.cc | 109 > > 5 files changed, 217 insertions(+), 6 deletions(-) > > > Add a function that takes a string as input and returns another string > which is > a hash of the input string generated using a collision-resistant hash > function. > > diff --git a/README b/README > --- a/README > +++ b/README > @@ -425,6 +425,7 @@ The following software is required to bu > > * libc6-dev (2.11 or later) > * libxml2-dev (2.7 or later) > +* libssl-dev (0.9.8 or later) > * automake (1.11.1 or later) > * m4 > * autoconf (2.64 or later) > @@ -959,6 +960,7 @@ minimum version requirements of the foll > - GNU C Library (Glibc), version 2.11 or later > - GNU Compiler Collection (GCC), version 4.8.1 or later > - Libxml2, version 2.7 or later > +- Libopenssl, version 0.9.8 or later > - Libsqlite3, version 3.6 or later (only needed when configuring with >--enable-imm-pbe) > - OpenHPI, version 2.17.0 or later (only needed when configuring with > diff --git a/src/base/Makefile.am b/src/base/Makefile.am > --- a/src/base/Makefile.am > +++ b/src/base/Makefile.am > @@ -35,6 +35,7 @@ lib_libopensaf_core_la_SOURCES += \ > src/base/daemon.c \ > src/base/file_notify.cc \ > src/base/getenv.cc \ > +src/base/hash.cc \ > src/base/hj_dec.c \ > src/base/hj_edp.c \ > src/base/hj_edu.c \ > @@ -79,6 +80,7 @@ noinst_HEADERS += \ > src/base/daemon.h \ > src/base/file_notify.h \ > src/base/getenv.h \ > +src/base/hash.h \ > src/base/log_message.h \ > src/base/logtrace.h \ > src/base/macros.h \ > @@ -176,16 +178,19 @@ bin_libbase_test_CPPFLAGS = \ > > bin_libbase_test_LDFLAGS = \ > $(AM_LDFLAGS) \ > -src/base/lib_libopensaf_core_la-unix_socket.lo \ > -src/base/lib_libopensaf_core_la-unix_server_socket.lo \ > +-lcrypto \ > +src/base/lib_libopensaf_core_la-file_notify.lo \ > src/base/lib_libopensaf_core_la-getenv.lo \ > +src/base/lib_libopensaf_core_la-hash.lo \ > src/base/lib_libopensaf_core_la-log_message.lo \ > src/base/lib_libopensaf_core_la-process.lo \ > -src/base/lib_libopensaf_core_la-file_notify.lo > +src/base/lib_libopensaf_core_la-unix_server_socket.lo \ > +src/base/lib_libopensaf_core_la-unix_socket.lo > > bin_libbase_test_SOURCES = \ > -src/base/tests/unix_socket_test.cc \ > +src/base/tests/file_notify_test.cc \ > src/base/tests/getenv_test.cc \ > +src/base/tests/hash_test.cc \ > src/base/tests/log_message_test.cc \ > src/base/tests/mock_logtrace.cc \ > src/base/tests/mock_osaf_abort.cc \ > @@ -193,8 +198,8 @@ bin_libbase_test_SOURCES = \ > src/base/tests/time_add_test.cc \ > src/base/tests/time_compare_test.cc \ > src/base/tests/time_convert_test.cc \ > -src/base/tests/file_notify_test.cc \ > -src/base/tests/time_subtract_test.cc > +src/base/tests/time_subtract_test.cc \ > +src/base/tests/unix_socket_test.cc > > bin_libbase_test_LDADD = \ > $(GTEST_DIR)/lib/libgtest.la \ > diff --git a/src/base/hash.cc b/src/base/hash.cc > new file mode 100644 > --- /dev/null > +++ b/src/base/hash.cc > @@ -0,0 +1,28 @@ > +/* -*- OpenSAF -*- > + * > + * Copyright Ericsson AB 2017 - All Rights Reserved. > + * > + * This program is distributed in the hope that it will be useful, but > + * WITHOUT ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY > + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are > licensed > + * under the GNU Lesser General Public License Version 2.1, February > 1999. > + * The complete license can be accessed from the following location: > + * http://opensource.org/licenses/lgpl-license.php > + * See the Copying file included with the OpenSAF distribution for full > + * licensing terms. > + * > + */ > + > +#include "base/hash.h" > + > +namespace base { > + > +const char kHashFunctionAlphabet[64] = { > + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', > 'N', 'O', > + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', > 'c', 'd', > + 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', > 'r', 's', > + 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', > '6', '7', > + '8', '9', '-', '_' > +}; > + > +} // namespace ba
Re: [devel] [PATCH 1 of 1] base: Add a collision-resistant hash function [#2266]
Ack. Thanks, Ramesh. On 2/28/2017 3:18 PM, Anders Widell wrote: > README |2 + > src/base/Makefile.am| 18 -- > src/base/hash.cc| 28 +++ > src/base/hash.h | 67 +++ > src/base/tests/hash_test.cc | 109 > > 5 files changed, 217 insertions(+), 7 deletions(-) > > > Add a function that takes a string as input and returns another string which > is > a hash of the input string generated using a collision-resistant hash > function. > > diff --git a/README b/README > --- a/README > +++ b/README > @@ -425,6 +425,7 @@ The following software is required to bu > > * libc6-dev (2.11 or later) > * libxml2-dev (2.7 or later) > +* libssl-dev (0.9.8 or later) > * automake (1.11.1 or later) > * m4 > * autoconf (2.64 or later) > @@ -959,6 +960,7 @@ minimum version requirements of the foll > - GNU C Library (Glibc), version 2.11 or later > - GNU Compiler Collection (GCC), version 4.8.1 or later > - Libxml2, version 2.7 or later > +- Libopenssl, version 0.9.8 or later > - Libsqlite3, version 3.6 or later (only needed when configuring with > --enable-imm-pbe) > - OpenHPI, version 2.17.0 or later (only needed when configuring with > diff --git a/src/base/Makefile.am b/src/base/Makefile.am > --- a/src/base/Makefile.am > +++ b/src/base/Makefile.am > @@ -37,6 +37,7 @@ lib_libopensaf_core_la_SOURCES += \ > src/base/file_descriptor.cc \ > src/base/file_notify.cc \ > src/base/getenv.cc \ > + src/base/hash.cc \ > src/base/hj_dec.c \ > src/base/hj_edp.c \ > src/base/hj_edu.c \ > @@ -83,6 +84,7 @@ noinst_HEADERS += \ > src/base/file_descriptor.h \ > src/base/file_notify.h \ > src/base/getenv.h \ > + src/base/hash.h \ > src/base/log_message.h \ > src/base/logtrace.h \ > src/base/macros.h \ > @@ -180,17 +182,19 @@ bin_libbase_test_CPPFLAGS = \ > > bin_libbase_test_LDFLAGS = \ > $(AM_LDFLAGS) \ > - src/base/lib_libopensaf_core_la-unix_socket.lo \ > - src/base/lib_libopensaf_core_la-unix_server_socket.lo \ > + -lcrypto \ > + src/base/lib_libopensaf_core_la-file_descriptor.lo \ > + src/base/lib_libopensaf_core_la-file_notify.lo \ > src/base/lib_libopensaf_core_la-getenv.lo \ > + src/base/lib_libopensaf_core_la-hash.lo \ > src/base/lib_libopensaf_core_la-log_message.lo \ > src/base/lib_libopensaf_core_la-process.lo \ > - src/base/lib_libopensaf_core_la-file_descriptor.lo \ > - src/base/lib_libopensaf_core_la-file_notify.lo > + src/base/lib_libopensaf_core_la-unix_server_socket.lo \ > + src/base/lib_libopensaf_core_la-unix_socket.lo > > bin_libbase_test_SOURCES = \ > - src/base/tests/unix_socket_test.cc \ > src/base/tests/getenv_test.cc \ > + src/base/tests/hash_test.cc \ > src/base/tests/log_message_test.cc \ > src/base/tests/mock_logtrace.cc \ > src/base/tests/mock_osaf_abort.cc \ > @@ -198,8 +202,8 @@ bin_libbase_test_SOURCES = \ > src/base/tests/time_add_test.cc \ > src/base/tests/time_compare_test.cc \ > src/base/tests/time_convert_test.cc \ > - src/base/tests/file_notify_test.cc \ > - src/base/tests/time_subtract_test.cc > + src/base/tests/time_subtract_test.cc \ > + src/base/tests/unix_socket_test.cc > > bin_libbase_test_LDADD = \ > $(GTEST_DIR)/lib/libgtest.la \ > diff --git a/src/base/hash.cc b/src/base/hash.cc > new file mode 100644 > --- /dev/null > +++ b/src/base/hash.cc > @@ -0,0 +1,28 @@ > +/* -*- OpenSAF -*- > + * > + * Copyright Ericsson AB 2017 - All Rights Reserved. > + * > + * This program is distributed in the hope that it will be useful, but > + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY > + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed > + * under the GNU Lesser General Public License Version 2.1, February 1999. > + * The complete license can be accessed from the following location: > + * http://opensource.org/licenses/lgpl-license.php > + * See the Copying file included with the OpenSAF distribution for full > + * licensing terms. > + * > + */ > + > +#include "base/hash.h" > + > +namespace base { > + > +const char kHashFunctionAlphabet[64] = { > + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', > + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', > + 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', > + 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', > + '8', '9', '-', '_' > +}; > + > +} // namespace base > diff --git a/src/base/hash.h b/src/base/hash.h > new file mode 100644 > --- /dev/null > +++ b/src/base/hash.h > @@ -0,0 +1,67 @@ > +/* -*- OpenSAF -*- > + * > + * Copyright Ericsson AB 2017 - All Rights Re
[devel] [PATCH 1 of 1] osaf:fm on new-Active handling amfd up event of peer old-Active node which is going down[#2151] V2
src/fm/fmd/fm_evt.h |2 +- src/fm/fmd/fm_main.c | 78 ++--- src/fm/fmd/fm_mds.c | 181 -- 3 files changed, 155 insertions(+), 106 deletions(-) diff --git a/src/fm/fmd/fm_evt.h b/src/fm/fmd/fm_evt.h --- a/src/fm/fmd/fm_evt.h +++ b/src/fm/fmd/fm_evt.h @@ -1,6 +1,7 @@ /* -*- OpenSAF -*- * * (C) Copyright 2008 The OpenSAF Foundation +* Copyright (C) 2017, Oracle and/or its affiliates. All rights reserved. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -49,7 +50,6 @@ typedef enum { FM_EVT_NODE_DOWN, FM_EVT_PEER_UP, FM_EVT_RDA_ROLE, - FM_EVT_SVC_DOWN, FM_FSM_EVT_MAX } FM_FSM_EVT_CODE; diff --git a/src/fm/fmd/fm_main.c b/src/fm/fmd/fm_main.c --- a/src/fm/fmd/fm_main.c +++ b/src/fm/fmd/fm_main.c @@ -1,6 +1,7 @@ /* -*- OpenSAF -*- * * (C) Copyright 2008 The OpenSAF Foundation +* Copyright (C) 2017, Oracle and/or its affiliates. All rights reserved. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -31,6 +32,7 @@ This file contains the main() routine fo #include "nid/agent/nid_api.h" #include "fm.h" #include "base/osaf_time.h" +#include "base/osaf_poll.h" #define FM_CLM_API_TIMEOUT 100LL @@ -71,7 +73,6 @@ void handle_mbx_event(void); extern uint32_t fm_amf_init(FM_AMF_CB *fm_amf_cb); uint32_t gl_fm_hdl; static NCS_SEL_OBJ usr1_sel_obj; -void fm_proc_svc_down(FM_CB *cb, FM_EVT *fm_mbx_evt); /** * USR1 signal is used when AMF wants instantiate us as a @@ -176,6 +177,11 @@ int main(int argc, char *argv[]) */ fm_cb->control_tipc = true; /* Default behaviour */ + fm_cb->immd_down = true; + fm_cb->immnd_down = true; + fm_cb->amfnd_down = true; + fm_cb->amfd_down = true; + /* Create CB handle */ gl_fm_hdl = ncshm_create_hdl(NCS_HM_POOL_ID_COMMON, NCS_SERVICE_ID_GFM, (NCSCONTEXT)fm_cb); @@ -194,7 +200,7 @@ int main(int argc, char *argv[]) goto fm_init_failed; } -/* Attach MBX */ + /* Attach MBX */ if (m_NCS_IPC_ATTACH(&fm_cb->mbx) != NCSCC_RC_SUCCESS) { syslog(LOG_ERR, "m_NCS_IPC_ATTACH() failed."); goto fm_init_failed; @@ -268,7 +274,7 @@ int main(int argc, char *argv[]) /* notify the NID */ if (nid_started) - fm_nid_notify(NCSCC_RC_SUCCESS); + fm_nid_notify((uint32_t) NCSCC_RC_SUCCESS); while (1) { ret = poll(fds, nfds, -1); @@ -454,52 +460,6 @@ static uint32_t fm_get_args(FM_CB *fm_cb return NCSCC_RC_SUCCESS; } -void fm_proc_svc_down(FM_CB *cb, FM_EVT *fm_mbx_evt) -{ - switch (fm_mbx_evt->svc_id) { - case NCSMDS_SVC_ID_IMMND: - cb->immnd_down = true; - LOG_NO("IMMND down on: %x", cb->peer_node_id); - break; - case NCSMDS_SVC_ID_AVND: - cb->amfnd_down = true; - LOG_NO("AMFND down on: %x", cb->peer_node_id); - break; - case NCSMDS_SVC_ID_IMMD: - cb->immd_down = true; - LOG_NO("IMMD down on: %x", cb->peer_node_id); - break; - case NCSMDS_SVC_ID_AVD: - cb->amfd_down = true; - LOG_NO("AVD down on: %x", cb->peer_node_id); - break; - case NCSMDS_SVC_ID_GFM: - cb->fm_down = true; - LOG_NO("FM down on: %x", cb->peer_node_id); - break; - default: - break; - } - - /* Processing only for alternate node. - * Service downs of AMFND, IMMD, IMMND is the same as NODE_DOWN from 4.4 onwards. - * This is required to handle the usecase involving - * '/etc/init.d/opensafd stop' without an OS reboot cycle - * Process service downs only if OpenSAF is not controlling TIPC. - * If OpenSAF is controlling TIPC, just wait for NODE_DOWN to trigger failover. - */ - if (cb->immd_down && cb->immnd_down && cb->amfnd_down && cb->amfd_down && cb->fm_down) { - LOG_NO("Core services went down on node_id: %x", fm_mbx_evt->node_id); - fm_send_node_down_to_mbx(cb, fm_mbx_evt->node_id); - /* Reset peer downs, because we've made MDS RED subscriptions */ - cb->immd_down = false; - cb->immnd_down = false; - cb->amfnd_down = false; - cb->amfd_down = false; - cb->fm_down = false; - } -} - / * Name
[devel] [PATCH 0 of 1] Review Request for osaf:fm on new-Active handling amfd up event of peer old-Active node which is going down[#2151] V2
Summary:osaf:fm on new-Active handling amfd up event of peer old-Active node which is going down[#2151] V2 Review request for Trac Ticket(s):2151 Peer Reviewer(s): Anders, Nagendra, Praveen Affected branch(es): default(5.2) Development branch: default Impacted area Impact y/n Docsn Build systemn RPM/packaging n Configuration files n Startup scripts n SAF servicesy OpenSAF servicesn Core libraries n Samples n Tests n Other n Comments (indicate scope for each "y" above): - changeset f70760cdc9b2ca013702f9f18c926ad1fd504206 Author: Ramesh Betham Date: Thu, 02 Mar 2017 13:58:04 +0530 osaf:fm on new-Active handling amfd up event of peer old-Active node which is going down[#2151] V2 Complete diffstat: -- src/fm/fmd/fm_evt.h |2 +- src/fm/fmd/fm_main.c | 78 ++- src/fm/fmd/fm_mds.c | 181 +++-- 3 files changed, 155 insertions(+), 106 deletions(-) Testing Commands: - 1. Verify as per the reproducible steps mentioned in Ticket(#2151) description. 2. Verify switch-overs and failovers. Testing, Expected Results: -- Once fm on new-Active detects amfd process is still alive on the peer node which is going down (and no peer FM exist) issues a local-reboot by logging appropriate message for admin to check. Regular switchovers and failovers should pass. Conditions of Submission: - Ack from reviewers Arch Built StartedLinux distro --- mipsn n mips64 n n x86 n n x86_64 y y powerpc n n powerpc64 n n Reviewer Checklist: --- [Submitters: make sure that your review doesn't trigger any checkmarks!] Your checkin has not passed review because (see checked entries): ___ Your RR template is generally incomplete; it has too many blank entries that need proper data filled in. ___ You have failed to nominate the proper persons for review and push. ___ Your patches do not have proper short+long header ___ You have grammar/spelling in your header that is unacceptable. ___ You have exceeded a sensible line length in your headers/comments/text. ___ You have failed to put in a proper Trac Ticket # into your commits. ___ You have incorrectly put/left internal data in your comments/files (i.e. internal bug tracking tool IDs, product names etc) ___ You have not given any evidence of testing beyond basic build tests. Demonstrate some level of runtime or other sanity testing. ___ You have ^M present in some of your files. These have to be removed. ___ You have needlessly changed whitespace or added whitespace crimes like trailing spaces, or spaces before tabs. ___ You have mixed real technical changes with whitespace and other cosmetic code cleanup changes. These have to be separate commits. ___ You need to refactor your submission into logical chunks; there is too much content into a single commit. ___ You have extraneous garbage in your review (merge commits etc) ___ You have giant attachments which should never have been sent; Instead you should place your content in a public tree to be pulled. ___ You have too many commits attached to an e-mail; resend as threaded commits, or place in a public tree for a pull. ___ You have resent this content multiple times without a clear indication of what has changed between each re-send. ___ You have failed to adequately and individually address all of the comments and change requests that were proposed in the initial review. ___ You have a misconfigured ~/.hgrc file (i.e. username, email etc) ___ Your computer have a badly configured date and time; confusing the the threaded patch review. ___ Your changes affect IPC mechanism, and you don't present any results for in-service upgradability test. ___ Your changes affect user manual and documentation, your patch series do not contain the patch that updates the Doxygen manual. -- 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 of 1] osaf:fm on new-Active handling amfd up event of peer old-Active node which is going down[#2151] V2
Hi, Correctionto the patch. + /* Weird situation in a cluster, where the new-Active controller node founds the peer node +* (old-Active) is still in the progress of shutdown (i.e., amfd/immd is still alive). +*/ + if ((fm_cb->role == PCS_RDA_ACTIVE) && (fm_cb->csi_assigned == false)) { + LOG_ER("Two active controllers observed in a cluster, newActive: %x and old-Active: %x", fm_cb->node_id, fm_cb->peer_node_id); + opensaf_reboot(fm_cb->peer_node_id, NULL, correction: opensaf_reboot(0, NULL, + "Received svc up from peer node (old-active is not fully DOWN), hence rebooting the new Active"); + } Thanks, Ramesh. On 3/2/2017 2:02 PM, ramesh.bet...@oracle.com wrote: > src/fm/fmd/fm_evt.h |2 +- > src/fm/fmd/fm_main.c | 78 ++--- > src/fm/fmd/fm_mds.c | 181 > -- > 3 files changed, 155 insertions(+), 106 deletions(-) > > > diff --git a/src/fm/fmd/fm_evt.h b/src/fm/fmd/fm_evt.h > --- a/src/fm/fmd/fm_evt.h > +++ b/src/fm/fmd/fm_evt.h > @@ -1,6 +1,7 @@ > /* -*- OpenSAF -*- > * > * (C) Copyright 2008 The OpenSAF Foundation > +* Copyright (C) 2017, Oracle and/or its affiliates. All rights reserved. > * > * This program is distributed in the hope that it will be useful, but > * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY > @@ -49,7 +50,6 @@ typedef enum { > FM_EVT_NODE_DOWN, > FM_EVT_PEER_UP, > FM_EVT_RDA_ROLE, > - FM_EVT_SVC_DOWN, > FM_FSM_EVT_MAX > } FM_FSM_EVT_CODE; > > diff --git a/src/fm/fmd/fm_main.c b/src/fm/fmd/fm_main.c > --- a/src/fm/fmd/fm_main.c > +++ b/src/fm/fmd/fm_main.c > @@ -1,6 +1,7 @@ > /* -*- OpenSAF -*- > * > * (C) Copyright 2008 The OpenSAF Foundation > +* Copyright (C) 2017, Oracle and/or its affiliates. All rights reserved. > * > * This program is distributed in the hope that it will be useful, but > * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY > @@ -31,6 +32,7 @@ This file contains the main() routine fo > #include "nid/agent/nid_api.h" > #include "fm.h" > #include "base/osaf_time.h" > +#include "base/osaf_poll.h" > > #define FM_CLM_API_TIMEOUT 100LL > > @@ -71,7 +73,6 @@ void handle_mbx_event(void); > extern uint32_t fm_amf_init(FM_AMF_CB *fm_amf_cb); > uint32_t gl_fm_hdl; > static NCS_SEL_OBJ usr1_sel_obj; > -void fm_proc_svc_down(FM_CB *cb, FM_EVT *fm_mbx_evt); > > /** >* USR1 signal is used when AMF wants instantiate us as a > @@ -176,6 +177,11 @@ int main(int argc, char *argv[]) >*/ > fm_cb->control_tipc = true; /* Default behaviour */ > > + fm_cb->immd_down = true; > + fm_cb->immnd_down = true; > + fm_cb->amfnd_down = true; > + fm_cb->amfd_down = true; > + > /* Create CB handle */ > gl_fm_hdl = ncshm_create_hdl(NCS_HM_POOL_ID_COMMON, NCS_SERVICE_ID_GFM, > (NCSCONTEXT)fm_cb); > > @@ -194,7 +200,7 @@ int main(int argc, char *argv[]) > goto fm_init_failed; > } > > -/* Attach MBX */ > + /* Attach MBX */ > if (m_NCS_IPC_ATTACH(&fm_cb->mbx) != NCSCC_RC_SUCCESS) { > syslog(LOG_ERR, "m_NCS_IPC_ATTACH() failed."); > goto fm_init_failed; > @@ -268,7 +274,7 @@ int main(int argc, char *argv[]) > > /* notify the NID */ > if (nid_started) > - fm_nid_notify(NCSCC_RC_SUCCESS); > + fm_nid_notify((uint32_t) NCSCC_RC_SUCCESS); > > while (1) { > ret = poll(fds, nfds, -1); > @@ -454,52 +460,6 @@ static uint32_t fm_get_args(FM_CB *fm_cb > return NCSCC_RC_SUCCESS; > } > > -void fm_proc_svc_down(FM_CB *cb, FM_EVT *fm_mbx_evt) > -{ > - switch (fm_mbx_evt->svc_id) { > - case NCSMDS_SVC_ID_IMMND: > - cb->immnd_down = true; > - LOG_NO("IMMND down on: %x", cb->peer_node_id); > - break; > - case NCSMDS_SVC_ID_AVND: > - cb->amfnd_down = true; > - LOG_NO("AMFND down on: %x", cb->peer_node_id); > - break; > - case NCSMDS_SVC_ID_IMMD: > - cb->immd_down = true; > - LOG_NO("IMMD down on: %x", cb->peer_node_id); > - break; > - case NCSMDS_SVC_ID_AVD: > - cb->amfd_down = true; > - LOG_NO("AVD down on: %x", cb->peer_node_id); > - break; > - case NCSMDS_SVC_ID_GFM: > - cb->fm_down = true; > - LOG_NO("FM down on: %x", cb->peer_node_id); > - break; > - default: > - break; > - } > - > - /* Processing only for alternate node. > - * Service downs of AM
Re: [devel] [PATCH 1 of 1] nid: OpenSAF failed to start on controller randomly [#2346]
Hi Hans, Just to check with you, were you able to reproduce the issue and this fix is resolving it. Because there can be some other reasons for open to fail. /Mar 10 12:26:11 suseR2-S1 opensafd//[2869]//: //*ER Failed to open /var/lib/opensaf/osaftransportd.fifo, error: No such device or address*/ /**/ Thanks, Ramesh.* * On 3/7/2017 12:50 PM, Hans Nordeback wrote: > src/nid/nodeinit.cc | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > > diff --git a/src/nid/nodeinit.cc b/src/nid/nodeinit.cc > --- a/src/nid/nodeinit.cc > +++ b/src/nid/nodeinit.cc > @@ -1436,7 +1436,7 @@ int handle_data_request(struct pollfd *f > } > fifo_fd = open(fifo_file.c_str(), O_WRONLY | O_NONBLOCK); > } while ((fifo_fd == -1) && > - (retry_cnt++ < 5 && (errno == EINTR || errno == ENXIO))); > + (retry_cnt++ < 50 && (errno == EINTR || errno == ENXIO))); > > if (fifo_fd == -1) { > LOG_ER("Failed to open %s, error: %s", fifo_file.c_str(), -- Announcing the Oxford Dictionaries API! The API offers world-renowned dictionary content that is easy and intuitive to access. Sign up for an account today to start using our lexical data to power your apps and projects. Get started today and enter our developer competition. http://sdm.link/oxford ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 1] nid: OpenSAF failed to start on controller randomly [#2346]
Ack. Thanks, Ramesh. On 3/7/2017 4:30 PM, Hans Nordebäck wrote: > > Hi Ramesh, > > I only increased the tolerance time, assuming that the time to start > transportd in this case is longer than usual. > > /Regards HansN > > *From:*ramesh betham [mailto:ramesh.bet...@oracle.com] > *Sent:* den 7 mars 2017 11:55 > *To:* Hans Nordebäck > *Cc:* Anders Widell ; > opensaf-devel@lists.sourceforge.net > *Subject:* Re: [PATCH 1 of 1] nid: OpenSAF failed to start on > controller randomly [#2346] > > Hi Hans, > > Just to check with you, were you able to reproduce the issue and this > fix is resolving it. Because there can be some other reasons for open > to fail. > > /Mar 10 12:26:11 suseR2-S1 opensafd[2869]: *ER Failed to open > /var/lib/opensaf/osaftransportd.fifo, error: No such device or > address*/ > > Thanks, > Ramesh.* > * > On 3/7/2017 12:50 PM, Hans Nordeback wrote: > > src/nid/nodeinit.cc | 2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > > > diff --git a/src/nid/nodeinit.cc b/src/nid/nodeinit.cc > > --- a/src/nid/nodeinit.cc > > +++ b/src/nid/nodeinit.cc > > @@ -1436,7 +1436,7 @@ int handle_data_request(struct pollfd *f > > } > > fifo_fd = open(fifo_file.c_str(), O_WRONLY | O_NONBLOCK); > > } while ((fifo_fd == -1) && > > - (retry_cnt++ < 5 && (errno == EINTR || errno == ENXIO))); > > + (retry_cnt++ < 50 && (errno == EINTR || errno == ENXIO))); > > > > if (fifo_fd == -1) { > > LOG_ER("Failed to open %s, error: %s", fifo_file.c_str(), > -- Announcing the Oxford Dictionaries API! The API offers world-renowned dictionary content that is easy and intuitive to access. Sign up for an account today to start using our lexical data to power your apps and projects. Get started today and enter our developer competition. http://sdm.link/oxford ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 1] cpd: update missed out node_users_cnt on standby [#2337]
Ack. Thanks, Ramesh. On 3/10/2017 11:17 AM, A V Mahesh wrote: > src/ckpt/ckptd/cpd_sbevt.c | 1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > > Fixed the missed-out/introduced issue of ticket #1669 patch node_users_cnt > variable > > diff --git a/src/ckpt/ckptd/cpd_sbevt.c b/src/ckpt/ckptd/cpd_sbevt.c > --- a/src/ckpt/ckptd/cpd_sbevt.c > +++ b/src/ckpt/ckptd/cpd_sbevt.c > @@ -586,6 +586,7 @@ uint32_t cpd_sb_proc_ckpt_usrinfo(CPD_CB > ckpt_node->num_sections = msg->info.usr_info_2.num_sections; > ckpt_node->ckpt_on_scxb1 = msg->info.usr_info_2.ckpt_on_scxb1; > ckpt_node->ckpt_on_scxb2 = msg->info.usr_info_2.ckpt_on_scxb2; > + ckpt_node->node_users_cnt = msg->info.usr_info_2.node_users_cnt; > > /* Free the old node_users */ > CPD_NODE_USER_INFO *node_user = ckpt_node->node_users; -- Announcing the Oxford Dictionaries API! The API offers world-renowned dictionary content that is easy and intuitive to access. Sign up for an account today to start using our lexical data to power your apps and projects. Get started today and enter our developer competition. http://sdm.link/oxford ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 1] base: Add osaf_timerfd_* utility functions [#777]
Hi Anders. Ack with minor comments. * Its very likely that user may pass some invalid value (say.. fd value) for which the current implementation is doing osaf_abort(). Why it can't be considered error with return of "EINVAL". * Better to document that the following function won't allow periodic expiration notifications. Otherwise, there is a possibility of user setting /utmr->it_interval.tv_(n)sec/ to non-zero. /void osaf_timerfd_settime(int ufd, int flags,// // const struct itimerspec* utmr,// // struct itimerspec* otmr)// //{// //if ((flags != 0 && flags != OSAF_TFD_TIMER_ABSTIME) ||// //utmr->it_interval.tv_sec != 0 ||// //utmr->it_interval.tv_nsec != 0) {/ Thanks and Regards. Ramesh. On 12/22/2015 9:33 PM, Anders Widell wrote: > osaf/libs/core/common/Makefile.am|1 + > osaf/libs/core/common/include/Makefile.am|1 + > osaf/libs/core/common/include/osaf_timerfd.h | 131 + > osaf/libs/core/common/osaf_timerfd.c | 264 > +++ > 4 files changed, 397 insertions(+), 0 deletions(-) > > > Add the utility functions osaf_timerfd_create(), osaf_timerfd_settime(), > osaf_timerfd_gettime() and osaf_timerfd_close(), which have functionality > corresponding to the Linux functions timerfd_create(), timerfd_settime(), > timerfd_gettime() and close(), respectively. > > The main reason for implementing these functions here is that they are missing > in LSB (Linux Standard Base), which means that the use these Linux functions > are > currently prohibited in OpenSAF. As an additional benefit, the variants > implemented here can never fail (they will abort() on failure), which means > that > the user does not have implement code for error handling. > > diff --git a/osaf/libs/core/common/Makefile.am > b/osaf/libs/core/common/Makefile.am > --- a/osaf/libs/core/common/Makefile.am > +++ b/osaf/libs/core/common/Makefile.am > @@ -34,6 +34,7 @@ libopensaf_common_la_SOURCES = \ > osaf_utility.c \ > osaf_poll.c \ > osaf_time.c \ > + osaf_timerfd.c \ > osaf_extended_name.c \ > nid_start_util.c \ > saf_edu.c \ > diff --git a/osaf/libs/core/common/include/Makefile.am > b/osaf/libs/core/common/include/Makefile.am > --- a/osaf/libs/core/common/include/Makefile.am > +++ b/osaf/libs/core/common/include/Makefile.am > @@ -34,5 +34,6 @@ noinst_HEADERS = \ > osaf_unicode.h \ > osaf_poll.h \ > osaf_time.h \ > + osaf_timerfd.h \ > saf_error.h \ > osaf_secutil.h > diff --git a/osaf/libs/core/common/include/osaf_timerfd.h > b/osaf/libs/core/common/include/osaf_timerfd.h > new file mode 100644 > --- /dev/null > +++ b/osaf/libs/core/common/include/osaf_timerfd.h > @@ -0,0 +1,131 @@ > +/* -*- OpenSAF -*- > + * > + * (C) Copyright 2015 The OpenSAF Foundation > + * > + * This program is distributed in the hope that it will be useful, but > + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY > + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed > + * under the GNU Lesser General Public License Version 2.1, February 1999. > + * The complete license can be accessed from the following location: > + * http://opensource.org/licenses/lgpl-license.php > + * See the Copying file included with the OpenSAF distribution for full > + * licensing terms. > + * > + * Author(s): Ericsson AB > + * > + */ > + > +/** @file > + * > + * This file contains an OpenSAF replacement of the Linux functions > + * timerfd_create(), timerfd_settime() and timerfd_gettime(). The main reason > + * for implementing these functions here is that they are missing in LSB > (Linux > + * Standard Base), which means that the use these Linux functions are > currently > + * prohibited in OpenSAF. As an additional benefit, the variants implemented > + * here can never fail (they will abort() on failure), which means that the > user > + * does not have implement code for error handling. > + * > + * When using the functions declared in this header file, you must be > consistent > + * and always use them (i.e. not mix the usage of these functions with the > Linux > + * conuterparts). Also, when using the flags parameter to > osaf_timerfd_create() > + * and osaf_timerfd_settime(), you must add the OSAF_ prefix to any flag > value > + * that you use, e.g. use OSAF_TFD_TIMER_ABSTIME instead of > TFD_TIMER_ABSTIME. > + * > + * Note that these functions are currently implemented using a linear search > + * algorithm to find the internal timer data structures. Therefore, they will > + * not be able to handle a large number of timers efficiently. The > + * reccomendation is to use a maximum of around ten timers per Linux > process. If > + * more timers are needed, then these functions should be improved to use a > more > + * efficient data structure. > +
Re: [devel] [PATCH 1 of 1] nid: Ensure that a service can only respond to NID once [#79]
Ack. Not tested. Regards, Ramesh. On 2/29/2016 5:27 PM, Anders Widell wrote: > osaf/libs/core/include/nid_api.h | 3 +- > osaf/libs/core/leap/nid_api.c| 64 > --- > 2 files changed, 8 insertions(+), 59 deletions(-) > > > Add a protection mechanism so that a service can only respond to NID once, > even > if it calls nid_notify() multiple times. > > diff --git a/osaf/libs/core/include/nid_api.h > b/osaf/libs/core/include/nid_api.h > --- a/osaf/libs/core/include/nid_api.h > +++ b/osaf/libs/core/include/nid_api.h > @@ -64,8 +64,7 @@ typedef struct nid_fifo_msg { > /** >*Exported finctions by NID_API* >**/ > -uint32_t nid_notify(char *, uint32_t, uint32_t *); > -uint32_t nis_notify(char *, uint32_t *); > +uint32_t nid_notify(const char*, uint32_t, uint32_t*); > uint32_t nid_create_ipc(char *); > uint32_t nid_open_ipc(int32_t *fd, char *); > void nid_close_ipc(void); > diff --git a/osaf/libs/core/leap/nid_api.c b/osaf/libs/core/leap/nid_api.c > --- a/osaf/libs/core/leap/nid_api.c > +++ b/osaf/libs/core/leap/nid_api.c > @@ -29,6 +29,9 @@ > > */ > > #include > +#include > + > +static bool is_nid_notified = false; > > > / >* Name : nid_notify > * > @@ -43,7 +46,7 @@ >* > * >* Notes : None. > * > > ***/ > -uint32_t nid_notify(char *service, uint32_t status, uint32_t *error) > +uint32_t nid_notify(const char* service, uint32_t status, uint32_t* error) > { > uint32_t scode; > char msg[250]; > @@ -51,6 +54,8 @@ uint32_t nid_notify(char *service, uint3 > uint32_t retry = 3; > char strbuff[256]; > > + if (is_nid_notified) return NCSCC_RC_SUCCESS; > + > scode = status; > > if ((scode < 0)) { > @@ -90,62 +95,7 @@ uint32_t nid_notify(char *service, uint3 > return NCSCC_RC_FAILURE; > } > > + is_nid_notified = true; > nid_close_ipc(); > return NCSCC_RC_SUCCESS; > } > - > -/ > - * Name : nis_notify * > - * * > - * Description : Opens the FIFO to bladeinitd and write the service and * > - * status code to FIFO. * > - * * > - * Arguments : status - input parameter providing status * > - * error- output parameter to return error code if any * > - * Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE.. * > - * * > - * Notes : None.* > - ***/ > -uint32_t nis_notify(char *status, uint32_t *error) > -{ > - int32_t fd = -1; > - uint32_t retry = 3; > - char strbuff[256]; > - > - if (status == NULL) { > - if (error != NULL) > - *error = NID_INV_PARAM; > - return NCSCC_RC_FAILURE; > - } > - > - while (retry) { > - if (nid_open_ipc(&fd, strbuff) != NCSCC_RC_SUCCESS) { > - retry--; > - } else > - break; > - } > - > - if ((fd < 0) && (retry == 0)) { > - if (error != NULL) > - *error = NID_OFIFO_ERR; > - return NCSCC_RC_FAILURE; > - } > - > - /* Send the message */ > - retry = 3; > - while (retry) { > - if (write(fd, status, strlen(status)) == strlen(status)) > - break; > - else > - retry--; > - } > - > - if (retry == 0) { > - if (error != NULL) > - *error = NID_WFIFO_ERR; > - return NCSCC_RC_FAILURE; > - } > - > - nid_close_ipc(); > - return NCSCC_RC_SUCCESS; > -} -- Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and i
Re: [devel] [PATCH 1 of 1] base: Add functions for extracting Slot, Subslot and Chassis from Node ID [#1613]
Ack. Not tested. Regards, Ramesh. On 3/18/2016 9:30 PM, Anders Widell wrote: > osaf/libs/core/common/ncs_main_pub.c | 13 - > osaf/libs/core/include/ncs_main_papi.h | 16 > osaf/libs/core/include/ncsgl_defs.h| 7 ++- > 3 files changed, 26 insertions(+), 10 deletions(-) > > > Add new utility functions for extracting Slot, Subslot and Chassis from a Node > ID. Also add a new constant for the maximum supported number of slots and > subslots in the system. > > diff --git a/osaf/libs/core/common/ncs_main_pub.c > b/osaf/libs/core/common/ncs_main_pub.c > --- a/osaf/libs/core/common/ncs_main_pub.c > +++ b/osaf/libs/core/common/ncs_main_pub.c > @@ -139,7 +139,7 @@ typedef struct ncs_main_pub_cb { > } NCS_MAIN_PUB_CB; > > typedef struct ncs_sys_params { > - NCS_PHY_SLOT_ID slot_id; > + SlotSubslotId slot_subslot_id; > NCS_CHASSIS_ID shelf_id; > NCS_NODE_ID node_id; > uint32_t cluster_id; > @@ -714,7 +714,6 @@ void ncs_get_sys_params_arg(NCS_SYS_PARA > char *p_field; > uint32_t tmp_ctr; > uint32_t orig_argc; > - NCS_SUB_SLOT_ID sub_slot_id = 0; > NCS_SYS_PARAMS params; > char *ptr; > int argc = 0; > @@ -756,17 +755,13 @@ void ncs_get_sys_params_arg(NCS_SYS_PARA > > gl_ncs_main_pub_cb.my_nodeid = sys_params->node_id; > > - if (m_NCS_GET_PHYINFO_FROM_NODE_ID(sys_params->node_id, > &sys_params->shelf_id, > -&sys_params->slot_id, &sub_slot_id) > != NCSCC_RC_SUCCESS) { > - > - m_LEAP_DBG_SINK_VOID; > - return; > - } > + sys_params->shelf_id = GetChassisIdFromNodeId(sys_params->node_id); > + sys_params->slot_subslot_id = > GetSlotSubslotIdFromNodeId(sys_params->node_id); > > sprintf(gl_pargv[orig_argc + 0], "NONE"); > sprintf(gl_pargv[orig_argc + 1], "CLUSTER_ID=%d", > sys_params->cluster_id); > sprintf(gl_pargv[orig_argc + 2], "SHELF_ID=%d", sys_params->shelf_id); > - sprintf(gl_pargv[orig_argc + 3], "SLOT_ID=%d", sys_params->slot_id); > + sprintf(gl_pargv[orig_argc + 3], "SLOT_ID=%d", > sys_params->slot_subslot_id); > sprintf(gl_pargv[orig_argc + 4], "NODE_ID=%d", sys_params->node_id); > sprintf(gl_pargv[orig_argc + 5], "PCON_ID=%d", sys_params->pcon_id); > > diff --git a/osaf/libs/core/include/ncs_main_papi.h > b/osaf/libs/core/include/ncs_main_papi.h > --- a/osaf/libs/core/include/ncs_main_papi.h > +++ b/osaf/libs/core/include/ncs_main_papi.h > @@ -112,6 +112,22 @@ extern "C" { > NCS_CHASSIS_ID *o_chassis_id, > NCS_PHY_SLOT_ID > *o_phy_slot_id, NCS_SUB_SLOT_ID *o_sub_slot_id); > > +static inline NCS_CHASSIS_ID GetChassisIdFromNodeId(NCS_NODE_ID node_id) > +{ > + uint32_t kChassisMask = 0xff; > + uint32_t chassis_id = (((uint32_t) node_id) >> 16) & kChassisMask; > + return chassis_id; > +} > + > +static inline SlotSubslotId GetSlotSubslotIdFromNodeId(NCS_NODE_ID node_id) > +{ > + uint32_t kSubslotMask = 0xf; > + uint32_t kSlotMask = 0xff; > + uint32_t subslot_id = ((uint32_t) node_id) & kSubslotMask; > + uint32_t slot_id = (((uint32_t) node_id) >> 8) & kSlotMask; > + return ((subslot_id ^ kSubslotMask) << 8) | slot_id; > +} > + > #ifdef __cplusplus > } > #endif > diff --git a/osaf/libs/core/include/ncsgl_defs.h > b/osaf/libs/core/include/ncsgl_defs.h > --- a/osaf/libs/core/include/ncsgl_defs.h > +++ b/osaf/libs/core/include/ncsgl_defs.h > @@ -73,8 +73,12 @@ extern "C" { > > /* >* Maximum Slots (Including sub slots) supported > - * 16 slots x 8 subslots > + * 256 slots x 16 subslots >*/ > +enum { > + kMaxSlotsSubslots = 4096 > +}; > + > #define NCS_SLOT_MAX 16 > > #define NCS_SUB_SLOT_MAX 16 > @@ -86,6 +90,7 @@ extern "C" { > typedef uint8_t NCS_CHASSIS_ID; > typedef uint8_t NCS_PHY_SLOT_ID; > typedef uint8_t NCS_SUB_SLOT_ID; > + typedef uint32_t SlotSubslotId; > > /* m_NCS_NODE_ID_FROM_MDS_DEST: Returns node-id if the MDS_DEST provided > is an absolute destination. Returns 0 -- Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140 ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 1] base: Remove old macros and type definitions [#1613]
Ack. Not tested. Regards, Ramesh. On 3/18/2016 9:47 PM, Anders Widell wrote: > osaf/libs/core/common/ncs_main_pub.c | 32 > > osaf/libs/core/include/ncs_main_papi.h | 24 > osaf/libs/core/include/ncsgl_defs.h| 8 > 3 files changed, 0 insertions(+), 64 deletions(-) > > > Remove the old macro m_NCS_GET_PHYINFO_FROM_NODE_ID and the types > NCS_PHY_SLOT_ID and NCS_SUB_SLOT_ID, which have been replaced by the new > function GetChassisIdFromNodeId(), GetSlotSubslotIdFromNodeId(), and the new > type SlotSubslotId. > > diff --git a/osaf/libs/core/common/ncs_main_pub.c > b/osaf/libs/core/common/ncs_main_pub.c > --- a/osaf/libs/core/common/ncs_main_pub.c > +++ b/osaf/libs/core/common/ncs_main_pub.c > @@ -801,35 +801,3 @@ char *ncs_util_search_argv_list(int argc > } > return NULL; > } > - > - > -/ > - Name : ncs_get_phyinfo_from_node_id > - > - Description : This function extracts chassis id,physical slot > -id and sub slot id from node_id > - > - Arguments : i_node_id -node id > - *o_chassis_id - chassis id > - *o_phy_slot_id - physical slot id > - *o_sub_slot_id - slot id > - > - Return Values : On Failure NCSCC_RC_FAILURE > - On Success NCSCC_RC_SUCCESS > - > - Notes : None. > -**/ > -uint8_t ncs_get_phyinfo_from_node_id(NCS_NODE_ID i_node_id, NCS_CHASSIS_ID > *o_chassis_id, > - NCS_PHY_SLOT_ID *o_phy_slot_id, > NCS_SUB_SLOT_ID *o_sub_slot_id) > -{ > - if (o_sub_slot_id != NULL) > - *o_sub_slot_id = ((NCS_SUB_SLOT_ID)i_node_id); > - > - if (o_chassis_id != NULL) > - *o_chassis_id = (NCS_CHASSIS_ID)(i_node_id >> 16); > - > - if (o_phy_slot_id != NULL) > - *o_phy_slot_id = (NCS_PHY_SLOT_ID)(i_node_id >> 8); > - > - return NCSCC_RC_SUCCESS; > -} > diff --git a/osaf/libs/core/include/ncs_main_papi.h > b/osaf/libs/core/include/ncs_main_papi.h > --- a/osaf/libs/core/include/ncs_main_papi.h > +++ b/osaf/libs/core/include/ncs_main_papi.h > @@ -88,30 +88,6 @@ extern "C" { > NCS_NODE_ID ncs_get_node_id(void); > #define m_NCS_GET_NODE_ID ncs_get_node_id() > > - > -#define m_NCS_GET_PHYINFO_FROM_NODE_ID( i_node_id, o_chassis_id, > o_phy_slot_id ,\ > -o_sub_slot_id) > ncs_get_phyinfo_from_node_id( i_node_id,\ > -o_chassis_id , o_phy_slot_id, > o_sub_slot_id) > -/ > - Name : ncs_get_phyinfo_from_node_id > - > - Description : This function extracts node_id from chassis id ,physical > - slot id and sub slot id into node_id > - > - Arguments : i_chassis_id - chassis id > - i_phy_slot_id - physical slot id > - i_sub_slot_id - slot id > - *o_node_id - node_id > - > - Return Values : On Failure NCSCC_RC_FAILURE > - On Success NCSCC_RC_SUCCESS > - > - Notes : None. > -**/ > - uint8_t ncs_get_phyinfo_from_node_id(NCS_NODE_ID i_node_id, > -NCS_CHASSIS_ID *o_chassis_id, > -NCS_PHY_SLOT_ID > *o_phy_slot_id, NCS_SUB_SLOT_ID *o_sub_slot_id); > - > static inline NCS_CHASSIS_ID GetChassisIdFromNodeId(NCS_NODE_ID node_id) > { > uint32_t kChassisMask = 0xff; > diff --git a/osaf/libs/core/include/ncsgl_defs.h > b/osaf/libs/core/include/ncsgl_defs.h > --- a/osaf/libs/core/include/ncsgl_defs.h > +++ b/osaf/libs/core/include/ncsgl_defs.h > @@ -79,17 +79,9 @@ enum { > kMaxSlotsSubslots = 4096 > }; > > -#define NCS_SLOT_MAX 16 > - > -#define NCS_SUB_SLOT_MAX 16 > - > -#define NCS_MAX_SLOTS ((NCS_SLOT_MAX * NCS_SUB_SLOT_MAX) + NCS_SLOT_MAX) > - > typedef uint64_t MDS_DEST; > typedef uint32_t NCS_NODE_ID; > typedef uint8_t NCS_CHASSIS_ID; > - typedef uint8_t NCS_PHY_SLOT_ID; > - typedef uint8_t NCS_SUB_SLOT_ID; > typedef uint32_t SlotSubslotId; > > /* m_NCS_NODE_ID_FROM_MDS_DEST: Returns node-id if the MDS_DEST provided -- Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140 ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-de
Re: [devel] [PATCH 1 of 1] nid: Support up to 4095 nodes [#1613]
Ack. Not tested. Regards, Ramesh. On 3/18/2016 9:42 PM, Anders Widell wrote: > osaf/services/infrastructure/nid/scripts/configure_tipc.in | 6 +++--- > osaf/services/infrastructure/nid/scripts/opensafd.in | 6 +++--- > 2 files changed, 6 insertions(+), 6 deletions(-) > > > Support up to 4095 nodes in the flat addressing scheme for TIPC, by encoding > the > slot ID in the lower eight bits and the ones' complement of the subslot ID in > bits 8 to 11 in the node identifier of the TIPC address. The reason for taking > the ones' complement of the subslot ID is backwards compatibility with > existing > installations, so that this enhancement can be upgraded in-service. > > diff --git a/osaf/services/infrastructure/nid/scripts/configure_tipc.in > b/osaf/services/infrastructure/nid/scripts/configure_tipc.in > --- a/osaf/services/infrastructure/nid/scripts/configure_tipc.in > +++ b/osaf/services/infrastructure/nid/scripts/configure_tipc.in > @@ -71,9 +71,9 @@ if ! test -f "$SLOT_ID_FILE"; then > exit 1 > fi > SLOT_ID=`cat "$SLOT_ID_FILE"` > -if [ "$SLOT_ID" -gt "255" ] || [ "$SLOT_ID" -lt "1" ] > +if [ "$SLOT_ID" -gt "4095" ] || [ "$SLOT_ID" -lt "1" ] > then > - echo "SLOT ID Should be in the range of 1 to 255" > + echo "SLOT ID Should be in the range of 1 to 4095" > echo "Quitting.." > exit 1 > fi > @@ -113,7 +113,7 @@ if [ $# -gt 1 ] ; then > fi > fi > > -printf "00%02x%02x%02x\n" $CHASSIS_ID $SLOT_ID $SUBSLOT_ID > > $pkglocalstatedir/node_id > +printf "00%02x%02x%02x\n" $CHASSIS_ID $((SLOT_ID & 255)) $((SUBSLOT_ID ^ > ((SLOT_ID >> 8) & 15) )) > $pkglocalstatedir/node_id > chmod 744 $pkglocalstatedir/node_id > if [ "$USE_SUBSLOT_ID" = "YES" ]; then > TIPC_NODEID=$(($SLOT_ID << $SHIFT4)) > diff --git a/osaf/services/infrastructure/nid/scripts/opensafd.in > b/osaf/services/infrastructure/nid/scripts/opensafd.in > --- a/osaf/services/infrastructure/nid/scripts/opensafd.in > +++ b/osaf/services/infrastructure/nid/scripts/opensafd.in > @@ -160,9 +160,9 @@ generate_nodeid() { > exit 1 > fi > SLOT_ID=`cat "$SLOT_ID_FILE"` > - if [ "$SLOT_ID" -gt "255" ] || [ "$SLOT_ID" -lt "1" ] > + if [ "$SLOT_ID" -gt "4095" ] || [ "$SLOT_ID" -lt "1" ] > then > - echo "SLOT ID Should be in the range of 1 to 255" > + echo "SLOT ID Should be in the range of 1 to 4095" > echo "Quitting.." > exit 1 > fi > @@ -176,7 +176,7 @@ generate_nodeid() { > echo "Quitting.." > exit 1 > fi > - printf "00%02x%02x%02x\n" $CHASSIS_ID $SLOT_ID $SUBSLOT_ID > > $pkglocalstatedir/node_id > + printf "00%02x%02x%02x\n" $CHASSIS_ID $((SLOT_ID & 255)) $((SUBSLOT_ID > ^ ((SLOT_ID >> 8) & 15) )) > $pkglocalstatedir/node_id > chmod 744 $pkglocalstatedir/node_id > } > -- Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140 ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 2 of 3] rde: Add QUIESCING and QUIESCED roles [#79]
Ack. Regards, Ramesh. On 2/29/2016 9:09 PM, Anders Widell wrote: > osaf/libs/agents/infrastructure/rda/rda_papi.cc | 6 ++ > osaf/tools/rde/rde_get_role.c | 6 ++ > 2 files changed, 12 insertions(+), 0 deletions(-) > > > Add support for the QUIESCING and QUIESCED roles in RDE as well as the > rdegetrole tool. > > diff --git a/osaf/libs/agents/infrastructure/rda/rda_papi.cc > b/osaf/libs/agents/infrastructure/rda/rda_papi.cc > --- a/osaf/libs/agents/infrastructure/rda/rda_papi.cc > +++ b/osaf/libs/agents/infrastructure/rda/rda_papi.cc > @@ -761,6 +761,12 @@ uint32_t rda_get_role(SaAmfHAStateT *ha_ > case PCS_RDA_STANDBY: > *ha_state = SA_AMF_HA_STANDBY; > break; > + case PCS_RDA_QUIESCED: > + *ha_state = SA_AMF_HA_QUIESCED; > + break; > + case PCS_RDA_QUIESCING: > + *ha_state = SA_AMF_HA_QUIESCING; > + break; > default: > return NCSCC_RC_FAILURE; > } > diff --git a/osaf/tools/rde/rde_get_role.c b/osaf/tools/rde/rde_get_role.c > --- a/osaf/tools/rde/rde_get_role.c > +++ b/osaf/tools/rde/rde_get_role.c > @@ -46,6 +46,12 @@ int main(int argc, char **argv) > else if (SA_AMF_HA_STANDBY == ha_state) { > printf("STANDBY\n"); > } > + else if (SA_AMF_HA_QUIESCED == ha_state) { > + printf("QUIESCED\n"); > + } > + else if (SA_AMF_HA_QUIESCING == ha_state) { > + printf("QUIESCING\n"); > + } > else { > printf("UNKNOWN\n"); > return EXIT_FAILURE; -- Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140 ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 3 of 3] rde: Generalize the role selection algorithm to work with more than two nodes [#79]
My initial comments.. 1. Can avoid peer discovery waiting state to certain fixed period by defining the spare-count in xml. What do you say.. 2. What is the idea behind introducing QUIESCING state when it is not used? Regards, Ramesh. On 2/29/2016 9:09 PM, Anders Widell wrote: > Makefile.am |3 +- > opensaf.spec.in |1 + > osaf/services/infrastructure/rde/Makefile.am |3 +- > osaf/services/infrastructure/rde/config/rde.conf |3 + > osaf/services/infrastructure/rde/include/Makefile.am |3 +- > osaf/services/infrastructure/rde/include/rde_amf.h |5 + > osaf/services/infrastructure/rde/include/rde_cb.h| 12 +- > osaf/services/infrastructure/rde/include/rde_rda.h |3 + > osaf/services/infrastructure/rde/include/role.h | 60 +++ > osaf/services/infrastructure/rde/rde_amf.cc | 42 +- > osaf/services/infrastructure/rde/rde_main.cc | 323 > +- > osaf/services/infrastructure/rde/rde_mds.cc | 76 ++- > osaf/services/infrastructure/rde/rde_rda.cc |7 +- > osaf/services/infrastructure/rde/role.cc | 144 > scripts/opensaf_sc_active| 30 + > 15 files changed, 439 insertions(+), 276 deletions(-) > > > Without changing the network protocol, generalize the role selection algorithm > used by RDE so that it works with more than two nodes. Nodes are now initially > given the QUIESCED role. When there are no ACTIVE or STANDBY nodes, the CLM > node > agent will initiate an election of a new ACTIVE node. RDE on the winning node > will set its role to ACTIVE. > > There is now also a new customizable script which is executed on a node before > it becomes ACTIVE. The purpose of this script is to perform necessary > preparations (if any) needed before a node can take on the ACTIVE role. For > example, shared files system may have to be mounted. > > diff --git a/Makefile.am b/Makefile.am > --- a/Makefile.am > +++ b/Makefile.am > @@ -187,7 +187,8 @@ nodist_pkgsysconf_DATA = \ > osaf_execbindir = $(pkglibdir) > dist_osaf_execbin_SCRIPTS = \ > $(top_srcdir)/scripts/opensaf_reboot \ > - $(top_srcdir)/scripts/opensaf_scale_out > + $(top_srcdir)/scripts/opensaf_scale_out \ > + $(top_srcdir)/scripts/opensaf_sc_active > > if ENABLE_RPM_TARGET > > diff --git a/opensaf.spec.in b/opensaf.spec.in > --- a/opensaf.spec.in > +++ b/opensaf.spec.in > @@ -948,6 +948,7 @@ fi > %{_pkglibdir}/opensafd > %{_pkglibdir}/opensaf_reboot > %{_pkglibdir}/opensaf_scale_out > +%{_pkglibdir}/opensaf_sc_active > %{_pkglibdir}/configure_tipc > > > diff --git a/osaf/services/infrastructure/rde/Makefile.am > b/osaf/services/infrastructure/rde/Makefile.am > --- a/osaf/services/infrastructure/rde/Makefile.am > +++ b/osaf/services/infrastructure/rde/Makefile.am > @@ -31,7 +31,8 @@ osafrded_SOURCES = \ > rde_amf.cc \ > rde_main.cc \ > rde_mds.cc \ > - rde_rda.cc > + rde_rda.cc \ > + role.cc > > osafrded_LDADD = \ > $(top_builddir)/osaf/libs/core/libopensaf_core.la \ > diff --git a/osaf/services/infrastructure/rde/config/rde.conf > b/osaf/services/infrastructure/rde/config/rde.conf > --- a/osaf/services/infrastructure/rde/config/rde.conf > +++ b/osaf/services/infrastructure/rde/config/rde.conf > @@ -10,6 +10,9 @@ > # waiting to discover a peer. Default is 2s. > #export RDE_DISCOVER_PEER_TIMEOUT=5000 > > +# Maximum execution time in milliseconds for the opensaf_sc_active script. > +#export RDE_PRE_ACTIVE_SCRIPT_TIMEOUT=5000 > + > # Healthcheck keys > export RDE_HA_ENV_HEALTHCHECK_KEY="Default" > > diff --git a/osaf/services/infrastructure/rde/include/Makefile.am > b/osaf/services/infrastructure/rde/include/Makefile.am > --- a/osaf/services/infrastructure/rde/include/Makefile.am > +++ b/osaf/services/infrastructure/rde/include/Makefile.am > @@ -22,4 +22,5 @@ noinst_HEADERS = \ > rde_amf.h \ > rde_cb.h \ > rde_rda.h \ > - rde_rda_common.h > + rde_rda_common.h \ > + role.h > diff --git a/osaf/services/infrastructure/rde/include/rde_amf.h > b/osaf/services/infrastructure/rde/include/rde_amf.h > --- a/osaf/services/infrastructure/rde/include/rde_amf.h > +++ b/osaf/services/infrastructure/rde/include/rde_amf.h > @@ -44,6 +44,8 @@ > #include "saAis.h" > #include "saAmf.h" > > +class Role; > + > /* >* Macro used to get the AMF version used >*/ > @@ -56,11 +58,14 @@ struct RDE_AMF_CB { > char comp_name[256]; > SaAmfHandleT amf_hdl; /* AMF handle */ > SaSelectionObjectT amf_fd; /* AMF selection fd */ > + Role* role; > bool is_amf_up; /* For amf_fd and pipe_fd */ > bool nid_started; /**< true if started by NID */ > > }; > > extern uint32_t rde_amf_init(RDE_AMF_CB *rde_amf_cb); > +extern SaAis
Re: [devel] [PATCH 1 of 1] base: Add C++ utility functions [#836]
No more comments from me. Have not reviewed ..\tests files. Thanks, Ramesh. On 3/23/2016 7:20 PM, Hans Nordebäck wrote: > Hi Anders, > > Minor comments below. /Thanks HansN > > -Original Message- > From: Anders Widell [mailto:anders.wid...@ericsson.com] > Sent: den 29 februari 2016 12:42 > To: ramesh.bet...@oracle.com > Cc: opensaf-devel@lists.sourceforge.net > Subject: [devel] [PATCH 1 of 1] base: Add C++ utility functions [#836] > > Makefile.common |3 +- > configure.ac |3 + > osaf/libs/core/Makefile.am|7 +- > osaf/libs/core/cplusplus/Makefile.am | 21 + > osaf/libs/core/cplusplus/base/Makefile.am | 42 ++ > osaf/libs/core/cplusplus/base/getenv.cc | 160 > osaf/libs/core/cplusplus/base/getenv.h| 40 ++ > osaf/libs/core/cplusplus/base/macros.h| 33 + > osaf/libs/core/cplusplus/base/process.cc | 204 ++ > osaf/libs/core/cplusplus/base/process.h | 113 + > osaf/libs/core/cplusplus/base/tests/Makefile.am | 49 ++ > osaf/libs/core/cplusplus/base/tests/getenv_test.cc| 105 + > osaf/libs/core/cplusplus/base/tests/mock_logtrace.cc | 32 + > osaf/libs/core/cplusplus/base/tests/mock_logtrace.h | 23 + > osaf/libs/core/cplusplus/base/tests/mock_osaf_abort.cc| 25 + > osaf/libs/core/cplusplus/base/tests/mock_osaf_abort.h | 23 + > osaf/libs/core/cplusplus/base/tests/mock_osafassert.cc| 27 + > osaf/libs/core/cplusplus/base/tests/mock_osafassert.h | 23 + > osaf/libs/core/cplusplus/base/tests/time_add_test.cc | 54 ++ > osaf/libs/core/cplusplus/base/tests/time_compare_test.cc | 195 + > osaf/libs/core/cplusplus/base/tests/time_convert_test.cc | 89 > osaf/libs/core/cplusplus/base/tests/time_subtract_test.cc | 52 ++ > osaf/libs/core/cplusplus/base/time.h | 275 > ++ > 23 files changed, 1594 insertions(+), 4 deletions(-) > > > Add the following C++ utility functions to the base component: > > * getenv.h - parsing of environment variables with default values > * macros.h - selecting behaviour of copy constructors and assignment operators > * process.h - time supervised execution of programs > * time.h - conversion to/from POSIX timespec structures > > diff --git a/Makefile.common b/Makefile.common > --- a/Makefile.common > +++ b/Makefile.common > @@ -6,7 +6,8 @@ CORE_INCLUDES = \ > -I$(top_srcdir)/osaf/libs/core/include \ > -I$(top_srcdir)/osaf/libs/core/leap/include \ > -I$(top_srcdir)/osaf/libs/core/mds/include \ > - -I$(top_srcdir)/osaf/libs/core/common/include > + -I$(top_srcdir)/osaf/libs/core/common/include \ > + -I$(top_srcdir)/osaf/libs/core/cplusplus > > AM_CPPFLAGS = \ > $(CORE_INCLUDES) \ > diff --git a/configure.ac b/configure.ac > --- a/configure.ac > +++ b/configure.ac > @@ -774,6 +774,9 @@ AC_CONFIG_FILES([ > osaf/libs/saf/libSaSmf/Makefile > osaf/libs/saf/libSaSmf/pkgconfig/Makefile > osaf/libs/saf/libSaSmf/pkgconfig/opensaf-smf.pc > +osaf/libs/core/cplusplus/Makefile > +osaf/libs/core/cplusplus/base/Makefile > +osaf/libs/core/cplusplus/base/tests/Makefile > osaf/services/Makefile > osaf/services/infrastructure/Makefile > osaf/services/infrastructure/dtms/Makefile > diff --git a/osaf/libs/core/Makefile.am b/osaf/libs/core/Makefile.am > --- a/osaf/libs/core/Makefile.am > +++ b/osaf/libs/core/Makefile.am > @@ -18,7 +18,7 @@ include $(top_srcdir)/Makefile.common > > MAINTAINERCLEANFILES = Makefile.in > > -SUBDIRS = include common leap mbcsv mds > +SUBDIRS = include common leap mbcsv mds cplusplus > > LIB_VERSION = 0:2:0 > > @@ -30,11 +30,12 @@ libopensaf_core_la_CPPFLAGS = \ > $(AM_CPPFLAGS) > > libopensaf_core_la_LDFLAGS = \ > - -lpthread -ldl -lrt \ > + -pthread -ldl -lrt -lstdc++ \ > -version-number $(LIB_VERSION) > > libopensaf_core_la_LIBADD = \ > $(top_builddir)/osaf/libs/core/common/libopensaf_common.la \ > $(top_builddir)/osaf/libs/core/leap/libleap.la \ > $(top_builddir)/osaf/libs/core/mbcsv/libmbca.la \ > - $(top_builddir)/osaf/libs/core/mds/libmds.la > + $(top_builddir)/osaf/libs/core/mds/libmds.la \ > + $(top_builddir)/osaf/libs/core/cplusplus/base/libbase.la > diff --git a/osaf/libs/core/cplusplus/Makefile.am > b/osaf/libs/core/cplusplus/Makefile.am > new file mode 100644 > --- /dev/null > +++ b/osaf/libs/core/cplusplus/Makefile.am > @@ -0,0 +1,21 @@ > +# -*- OpenSAF -*- > +# > +# (C) Copyright 2016 The OpenSAF Foundation > +# > +# This program is distributed in the hope that it will be useful, but > +# WITHOUT ANY WARRANTY; without even the
Re: [devel] [PATCH 1 of 1] leap: provide ensured disk space option for shm_open request [1712]
Let the following condition +if (posix_fallocate(req->info.open.o_fd, 0, shm_size) == ENOSPC) be +if (posix_fallocate(req->info.open.o_fd, 0, shm_size) != 0) and log appropriate err. Thanks, Ramesh. On 4/4/2016 4:59 PM, Anders Widell wrote: > Hi! > > See my comments inline, marked [AndersW]. > > regards, > Anders Widell > > On 04/04/2016 12:50 PM, A V Mahesh wrote: >> Hi Anders Widell , >> >> *Thank for the review , please find my responses .* >> >> On 4/4/2016 3:51 PM, Anders Widell wrote: >>> Hi! >>> >>> Here are my comments: >>> >>> 1) I think you need to make this feature configurable, as I see it >>> as potentially not backwards compatible. >> *[AVM]* The APIs used to fail with TIMEOUT ERR continuously (CPND >> used to crash in memcopy) in case of low disk space then requested , >> now this patch only makes the API succeed or returns >> correct error SA_AIS_ERR_NO_RESOURCES , >> so in this scenario,in that perspective it is only an >> improvement to the behavior. >> >> And since this is a POSIX call, I think it should not >> cause any backward compatibility issue from library perspective. > [AndersW] The backwards compatibility problem is that you are > pre-allocating shared memory, which was not done earlier. This means > that the memory consumption of OpenSAF could become higher than before. >>> >>> 2) A question: Have you considered alternative solutions? For >>> example, installing a signal handler for SIGBUS to catch the problem >>> and then propagate the error back to the CKPT API user? >> >> *[AVM]* I did think about that. With this approach, the issue(of >> lack of memory) is prevented upfront by returning error at ckptopen() >> itself which is beneficial to the user. >> >> Please let me know why it would be backward >> incompatible, because this approach improves the application behavior. > [AndersW] This approach would be backwards compatible, since we are > not increasing the memory consumption. >> >> -AVM >>> >>> regards, >>> Anders Widell >>> >>> On 04/04/2016 05:57 AM, A V Mahesh wrote: Hi Anders Widell/Ramesh, Can you please review this ticket by today , this has to go under 5.0.FC tag. -AVM > osaf/libs/core/include/ncs_osprm.h | 1 + > osaf/libs/core/leap/os_defs.c | 13 ++--- > osaf/services/saf/cpsv/cpnd/cpnd_proc.c | 1 + > osaf/services/saf/cpsv/cpnd/cpnd_res.c | 2 ++ > osaf/services/saf/glsv/glnd/glnd_shm.c | 1 + > osaf/services/saf/mqsv/mqnd/mqnd_shm.c | 1 + > 6 files changed, 16 insertions(+), 3 deletions(-) > > > Provided ensured disk space is allocated for > NCS_OS_POSIX_SHM_REQ_OPEN request using posix_fallocate() > so that application such as CPSV subsequent writes to bytes in > the specified range are guaranteed not to fail because of lack of > disk space. > Updated the Opensaf services according to new options based on > requirements . > > diff --git a/osaf/libs/core/include/ncs_osprm.h > b/osaf/libs/core/include/ncs_osprm.h > --- a/osaf/libs/core/include/ncs_osprm.h > +++ b/osaf/libs/core/include/ncs_osprm.h > @@ -564,6 +564,7 @@ uint32_t ncs_os_posix_mq(NCS_OS_POSIX_MQ > uint32_t i_flags; > uint32_t i_map_flags; > uint64_t i_size; > +bool ensures_space; > uint64_t i_offset; > void *o_addr; > int32_t o_fd; > diff --git a/osaf/libs/core/leap/os_defs.c > b/osaf/libs/core/leap/os_defs.c > --- a/osaf/libs/core/leap/os_defs.c > +++ b/osaf/libs/core/leap/os_defs.c > @@ -795,9 +795,16 @@ uint32_t ncs_os_posix_shm(NCS_OS_POSIX_S > if (req->info.open.o_fd < 0) { > return NCSCC_RC_FAILURE; > } else { > -if (ftruncate(req->info.open.o_fd, (off_t) shm_size > /* off_t == long */ ) < 0) { > -printf("ftruncate failed with errno value %d \n", > errno); > -return NCSCC_RC_FAILURE; > +if (req->info.open.ensures_space == true) { > +if (posix_fallocate(req->info.open.o_fd, 0, > shm_size) == ENOSPC) { > +LOG_ER("posix_shm:posix_fallocate failed() > with not enough space left ENOSPC: %d \n", errno); > +return NCSCC_RC_FAILURE; > +} > +} else { > +if (ftruncate(req->info.open.o_fd, (off_t) > shm_size /* off_t == long */ ) < 0) { > +printf("ftruncate failed with errno value %d > \n", errno); > +return NCSCC_RC_FAILURE; > +} > } > prot_flag = > ncs_shm_prot_flags(req->info.open.i_flags); > diff
Re: [devel] [PATCH 1 of 1] msg : binding with asapi must be done after mds init [#1748]
Ack. Thanks, Ramesh. On 4/13/2016 5:25 PM, Anders Widell wrote: > Ack. Tested. > > regards, > Anders Widell > > On 04/13/2016 01:53 PM, reddy.neelaka...@oracle.com wrote: >> osaf/services/saf/mqsv/mqd/mqd_api.c | 8 >> 1 files changed, 4 insertions(+), 4 deletions(-) >> >> >> The problem was introduced with msg patch for #79 >> >> diff --git a/osaf/services/saf/mqsv/mqd/mqd_api.c >> b/osaf/services/saf/mqsv/mqd/mqd_api.c >> --- a/osaf/services/saf/mqsv/mqd/mqd_api.c >> +++ b/osaf/services/saf/mqsv/mqd/mqd_api.c >> @@ -234,10 +234,6 @@ static uint32_t mqd_lib_init(void) >> #endif >> TRACE_1("saAmfComponentRegister Success"); >> -/* Bind with ASAPi Layer */ >> -mqd_asapi_bind(pMqd); >> -TRACE_1("Initialization Success"); >> - >> /* start the AMF Health Check */ >> memset(&healthy, 0, sizeof(SaAmfHealthcheckKeyT)); >> health_key = getenv("MQSV_ENV_HEALTHCHECK_KEY"); >> @@ -350,6 +346,10 @@ uint32_t initialize_for_assignment(MQD_C >> goto done; >> } >> +/* Bind with ASAPi Layer */ >> +mqd_asapi_bind(cb); >> +TRACE_1("Initialization Success"); >> + >> cb->fully_initialized = true; >> done: >> TRACE_LEAVE2("rc = %u", rc); > -- Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 1] leap: Evaluate characteristics of sysf_timer [#1520]
Ack. Thanks, Ramesh. On 4/21/2016 1:58 PM, Hans Nordeback wrote: > osaf/libs/core/leap/tests/Makefile.am |3 +- > osaf/libs/core/leap/tests/sysf_ipc_test.cc | 275 > +--- > 2 files changed, 90 insertions(+), 188 deletions(-) > > > As a start, two unit test cases are written. > The first unit test case, credit HansN, evaluates "jitter" using sysf_timer > as an interval timer. Elapsed times are written to stdout and e.g. gnuplot > can be used to display the result. > gnuplot> set ylabel "u sec" > gnuplot> plot "testleap.log" using 1 with lines. > The second unit test case, credit AndersW, creates a large number of sysf > timers. > > diff --git a/osaf/libs/core/leap/tests/Makefile.am > b/osaf/libs/core/leap/tests/Makefile.am > --- a/osaf/libs/core/leap/tests/Makefile.am > +++ b/osaf/libs/core/leap/tests/Makefile.am > @@ -34,7 +34,8 @@ testleap_LDFLAGS = \ > -lpthread > > testleap_SOURCES = \ > - sysf_ipc_test.cc > + sysf_ipc_test.cc \ > + sysf_tmr_test.cc > > testleap_LDADD = \ > $(GTEST_DIR)/lib/libgtest.la \ > diff --git a/osaf/libs/core/leap/tests/sysf_ipc_test.cc > b/osaf/libs/core/leap/tests/sysf_tmr_test.cc > old mode 100755 > new mode 100644 > copy from osaf/libs/core/leap/tests/sysf_ipc_test.cc > copy to osaf/libs/core/leap/tests/sysf_tmr_test.cc > --- a/osaf/libs/core/leap/tests/sysf_ipc_test.cc > +++ b/osaf/libs/core/leap/tests/sysf_tmr_test.cc > @@ -1,6 +1,6 @@ > /* -*- OpenSAF -*- >* > - * (C) Copyright 2015 The OpenSAF Foundation > + * (C) Copyright 2016 The OpenSAF Foundation >* >* This program is distributed in the hope that it will be useful, but >* WITHOUT ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY > @@ -18,53 +18,27 @@ > #include > #include > #include > -#include > -#include > -#include > -#include > -#include > -#include > +#include > +#include > +#include > > -#include "sysf_ipc.h" > +#include "ncssysf_tmr.h" > > -#include "ncs_main_papi.h" > #include "gtest/gtest.h" > > -std::mutex send_ctr_mutex; > +using namespace std::chrono; > > -typedef struct message_ { > - struct message_ *next; > - NCS_IPC_PRIORITY prio; > - int seq_no; > -} Message; > - > -bool mbox_clean(NCSCONTEXT arg, NCSCONTEXT msg) { > - Message *curr; > - Message *temp; > - > - /* clean the entire mailbox */ > - for (curr = (Message *)msg; curr;) { > -temp = curr; > -curr = curr->next; > - > -delete temp; > - } > - return true; > -} > - > -// The fixture for testing c-function sysf_ipc > -class SysfIpcTest : public ::testing::Test { > +// The fixture for testing c-function sysf_tmr > +class SysfTmrTest : public ::testing::Test { >public: > >protected: > > - SysfIpcTest() { > + SysfTmrTest() : distribution_(1 * 60 * 60 * 100, 2 * 60 * 60 * 100 - 1) { > // Setup work can be done here for each test. > -no_of_msgs_sent = 0; > -no_of_msgs_received = 0; > } > > - virtual ~SysfIpcTest() { > + virtual ~SysfTmrTest() { > // Cleanup work that doesn't throw exceptions here. > } > > @@ -74,183 +48,110 @@ class SysfIpcTest : public ::testing::Te > virtual void SetUp() { > // Code here will be called immediately after the constructor (right > // before each test). > -int rc = ncs_leap_startup(); > -// see ticket #1629, return code should be ok > -//ASSERT_EQ(rc, NCSCC_RC_SUCCESS); > +bool rc = sysfTmrCreate(); > +ASSERT_EQ(rc, true); > > -rc = m_NCS_IPC_CREATE(&mbox); > -ASSERT_EQ(rc, NCSCC_RC_SUCCESS); > - > -rc = m_NCS_IPC_ATTACH(&mbox); > -ASSERT_EQ(rc, NCSCC_RC_SUCCESS); > } > > virtual void TearDown() { > // Code here will be called immediately after each test (right > // before the destructor). > -int rc = m_NCS_IPC_DETACH(&mbox, mbox_clean, 0); > -ASSERT_EQ(rc, NCSCC_RC_SUCCESS); > - > -rc = m_NCS_IPC_RELEASE(&mbox, 0); > -ASSERT_EQ(rc, NCSCC_RC_SUCCESS); > - > -// see ticket #1629, calling ncs_leap_shutdown causes a segv. > -// ncs_leap_shutdown(); > - } > - > - void send_msg(NCS_IPC_PRIORITY prio, int seq_no) { > -Message *msg; > - > -msg = new Message; > -msg->prio = prio; > -msg->seq_no = seq_no; > -int rc = m_NCS_IPC_SEND(&mbox, msg, prio); > -ASSERT_EQ(rc, NCSCC_RC_SUCCESS); > - } > - > - void recv_msg(NCS_IPC_PRIORITY prio, int seq_no) { > -Message *msg; > - > -msg = reinterpret_cast(ncs_ipc_non_blk_recv(&mbox)); > -ASSERT_TRUE(msg != NULL); > -ASSERT_EQ(msg->prio, prio); > -ASSERT_EQ(msg->seq_no, seq_no); > -delete msg; > - } > - > - // > - static void MessageReceiver(); > - > - // > - static void MessageSender() { > -Message *msg; > -int prio; > -srand(time(NULL)); > -int rc = NCSCC_RC_SUCCESS; > - > -for (int i = 0; i < 60; ++i) { > - msg = new Message; > - > - prio = (random() % 3) + 1; > - msg->pr
Re: [devel] [PATCH 4 of 4] msg: init with clm before entering initialize_for_assignment() [#1781]
Ack, only after incorporating the following comments. 1. Please do /mqd_asapi_unbind();// //saAmfFinalize(pMqd->amf_hdl);// //ncshm_give_hdl(pMqd->hdl);// //mqd_cb_shut(pMqd);// / in case of return FAILURE for mqd_clm_init(). 2. Please correct mqd_clm_init(). Not required to do the following steps in mqd_clm_init() while returning for failures. mqd_mbcsv_finalize(cb); if (mqd_mds_shut(cb) != NCSCC_RC_SUCCESS) { TRACE_2("MDS Deregistration Failed"); } Thanks, Ramesh. On 4/28/2016 8:10 PM, mathi.naic...@oracle.com wrote: > osaf/services/saf/mqsv/mqd/mqd_api.c | 95 > --- > 1 files changed, 53 insertions(+), 42 deletions(-) > > > With the introduction of spares support #79, all services were modified to > wait for AMF role assignment > to register with MDS and proceed further with their lifecycle. > However, this is not necessary and would create a problem of 1781. > i.e. All services should ideally register with CLM independent of their HA > roles as provided by AMF or RDA. > But ofcourse until now only AMF, EVT, CKPT, MSG, NTF, SMF have been > integrated with CLM. > This patch makes the services register with CLM before entering the wait() > for AMF role. > NTF service is already handling this correctly. > This is also necessary to make OpenSAF services run - without abort, on nodes > that are administratively > locked/shutdown via CLM node admin commands. > A separate patch for SMF follow. > > diff --git a/osaf/services/saf/mqsv/mqd/mqd_api.c > b/osaf/services/saf/mqsv/mqd/mqd_api.c > --- a/osaf/services/saf/mqsv/mqd/mqd_api.c > +++ b/osaf/services/saf/mqsv/mqd/mqd_api.c > @@ -113,6 +113,55 @@ uint32_t mqd_lib_req(NCS_LIB_REQ_INFO *i > return rc; > } /* End of mqd_lib_req() */ > > +static SaAisErrorT mqd_clm_init (MQD_CB *cb) > +{ > + SaAisErrorT saErr = SA_AIS_OK; > + SaVersionT clm_version; > + SaClmCallbacksT mqd_clm_cbk; > + > + m_MQSV_GET_AMF_VER(clm_version); > + mqd_clm_cbk.saClmClusterNodeGetCallback = NULL; > + mqd_clm_cbk.saClmClusterTrackCallback = mqd_clm_cluster_track_callback; > + > + saErr = saClmInitialize(&cb->clm_hdl, &mqd_clm_cbk, &clm_version); > + if (saErr != SA_AIS_OK) { > + LOG_ER("saClmInitialize failed with error %u", (unsigned) > saErr); > + mqd_mbcsv_finalize(cb); > + if (mqd_mds_shut(cb) != NCSCC_RC_SUCCESS) { > + TRACE_2("MDS Deregistration Failed"); > + } > + goto done; > + } > + TRACE_1("saClmInitialize success"); > + > + saErr = saClmSelectionObjectGet(cb->clm_hdl, &cb->clm_sel_obj); > + if (SA_AIS_OK != saErr) { > + LOG_ER("saClmSelectionObjectGet failed with error %u", > (unsigned) saErr); > + mqd_mbcsv_finalize(cb); > + if (mqd_mds_shut(cb) != NCSCC_RC_SUCCESS) { > + TRACE_2("MDS Deregistration Failed"); > + } > + goto done; > + } > + TRACE_1("saClmSelectionObjectGet success"); > + > + saErr = saClmClusterTrack(cb->clm_hdl, SA_TRACK_CHANGES_ONLY, NULL); > + if (SA_AIS_OK != saErr) { > + LOG_ER("saClmClusterTrack failed with error %u", (unsigned) > saErr); > + mqd_mbcsv_finalize(cb); > + if (mqd_mds_shut(cb) != NCSCC_RC_SUCCESS) { > + TRACE_2("MDS Deregistration Failed"); > + } > + goto done; > + } > + TRACE_1("saClmClusterTrack success"); > + > +done: > + saClmFinalize(cb->clm_hdl); > + > + return saErr; > +} > + > > /\ > PROCEDURE NAME : mqd_lib_init > > @@ -256,6 +305,9 @@ static uint32_t mqd_lib_init(void) > return rc; > } > > + if (mqd_clm_init(pMqd) != SA_AIS_OK) > + return NCSCC_RC_FAILURE; > + > if ((rc = initialize_for_assignment(pMqd, pMqd->ha_state)) != > NCSCC_RC_SUCCESS) { > LOG_ER("initialize_for_assignment FAILED %u", (unsigned) rc); > @@ -271,9 +323,8 @@ uint32_t initialize_for_assignment(MQD_C > { > TRACE_ENTER2("ha_state = %d", (int) ha_state); > uint32_t rc = NCSCC_RC_SUCCESS; > - SaClmCallbacksT mqd_clm_cbk; > - SaVersionT clm_version; > SaAisErrorT saErr = SA_AIS_OK; > + > if (cb->fully_initialized || ha_state == SA_AMF_HA_QUIESCED) { > goto done; > } > @@ -293,46 +344,6 @@ uint32_t initialize_for_assignment(MQD_C > goto done; > } > > - m_MQSV_GET_AMF_VER(clm_version); > - mqd_clm_cbk.saClmClusterNodeGetCallback = NULL; > - mqd_clm_cbk.saClmClusterTrackCallback = mqd_clm_cluster_track_callback; > - > - saErr = saClmInitialize(&cb->clm_hdl, &mqd_clm_cbk, &clm_version); > - if (saErr != SA_AI
Re: [devel] [PATCH 3 of 4] evt: init with clm before entering initialize_for_assignment() [#1781]
Ack with a comment. Please do m_NCS_IPC_DETACH() in case of return FAILURE for clm_init(). However why eds_clm_init() can't be called before amf_register? Thanks, Ramesh.. On 4/28/2016 8:10 PM, mathi.naic...@oracle.com wrote: > osaf/services/saf/edsv/eds/eds_api.c | 23 ++- > 1 files changed, 14 insertions(+), 9 deletions(-) > > > With the introduction of spares support #79, all services were modified to > wait for AMF role assignment > to register with MDS and proceed further with their lifecycle. > However, this is not necessary and would create a problem of 1781. > i.e. All services should ideally register with CLM independent of their HA > roles as provided by AMF or RDA. > But ofcourse until now only AMF, EVT, CKPT, MSG, NTF, SMF have been > integrated with CLM. > This patch makes the services register with CLM before entering the wait() > for AMF role. > NTF service is already handling this correctly. > This is also necessary to make OpenSAF services run - without abort, on nodes > that are administratively > locked/shutdown via CLM node admin commands. > A separate patch for SMF follow. > > diff --git a/osaf/services/saf/edsv/eds/eds_api.c > b/osaf/services/saf/edsv/eds/eds_api.c > --- a/osaf/services/saf/edsv/eds/eds_api.c > +++ b/osaf/services/saf/edsv/eds/eds_api.c > @@ -113,6 +113,20 @@ static uint32_t eds_se_lib_init(NCS_LIB_ > exit(EXIT_FAILURE); > } > > + /* Initialize and Register with CLM */ > + if (eds_clm_init(eds_cb) != SA_AIS_OK) { > + LOG_ER("CLM Init failed"); > + /* Release EDU handle */ > + m_NCS_EDU_HDL_FLUSH(&eds_cb->edu_hdl); > + /* Destroy the hdl for this CB */ > + ncshm_destroy_hdl(NCS_SERVICE_ID_EDS, gl_eds_hdl); > + gl_eds_hdl = 0; > + /* Free the control block */ > + m_MMGR_FREE_EDS_CB(eds_cb); > + TRACE_LEAVE(); > + return NCSCC_RC_FAILURE; > + } > + > if ((rc = initialize_for_assignment(eds_cb, eds_cb->ha_state)) != > NCSCC_RC_SUCCESS) { > LOG_ER("initialize_for_assignment FAILED %u", (unsigned) rc); > @@ -128,7 +142,6 @@ uint32_t initialize_for_assignment(EDS_C > { > TRACE_ENTER2("ha_state = %d", (int) ha_state); > uint32_t rc = NCSCC_RC_SUCCESS; > - SaAisErrorT error; > if (cb->fully_initialized || ha_state == SA_AMF_HA_QUIESCED) { > goto done; > } > @@ -139,14 +152,6 @@ uint32_t initialize_for_assignment(EDS_C > goto done; > } > > - /* Initialize and Register with CLM */ > - error = eds_clm_init(cb); > - if (error != SA_AIS_OK) { > - LOG_ER("CLM Init failed: %u", (unsigned) error); > - rc = NCSCC_RC_FAILURE; > - goto done; > - } > - > /* Initialize mbcsv interface */ > if (NCSCC_RC_SUCCESS != (rc = eds_mbcsv_init(cb))) { > LOG_ER("eds mbcsv init failed"); -- Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 0 of 1] Review Request for rde: Fix cppcheck warnings [#1870]
Currently reviewing 1879 and followed by 1870 & 1871. Thanks, Ramesh. On 6/21/2016 2:24 AM, Anders Widell wrote: > Hi Ramesh! > > Did you get any chance to start looking at any of the patches for > ticket [#1870], [#1871] or [#1879] yet. > > thanks, > Anders Widell > > On 06/09/2016 12:29 PM, Anders Widell wrote: >> Summary: rde: Fix cppcheck warnings [#1870] >> Review request for Trac Ticket(s): 1870 >> Peer Reviewer(s): Ramesh >> Pull request to: >> Affected branch(es): default(5.1) >> Development branch: default >> >> >> Impacted area Impact y/n >> >> Docsn >> Build systemn >> RPM/packaging n >> Configuration files n >> Startup scripts n >> SAF servicesn >> OpenSAF servicesy >> Core libraries n >> Samples n >> Tests n >> Other n >> >> >> Comments (indicate scope for each "y" above): >> - >> >> changeset f2309bc01df86422049e5121a69f45aa766b4718 >> Author:Anders Widell >> Date:Thu, 09 Jun 2016 11:13:47 +0200 >> >> rde: Fix cppcheck warnings [#1870] >> >> The following warnings, reported by cppcheck version 1.74, have >> been fixed: >> >> [osaf/libs/agents/infrastructure/rda/rda_papi.cc:300]: (style) >> C-style >> pointer casting >> [osaf/libs/agents/infrastructure/rda/rda_papi.cc:347] -> >> [osaf/libs/agents/infrastructure/rda/rda_papi.cc:356]: (style) >> Variable 'rc' >> is reassigned a value before the old one has been used. >> [osaf/libs/agents/infrastructure/rda/rda_papi.cc:410] -> >> [osaf/libs/agents/infrastructure/rda/rda_papi.cc:421]: (style) >> Variable 'rc' >> is reassigned a value before the old one has been used. >> [osaf/libs/agents/infrastructure/rda/rda_papi.cc:585] -> >> [osaf/libs/agents/infrastructure/rda/rda_papi.cc:593]: (style) >> Variable 'rc' >> is reassigned a value before the old one has been used. >> [osaf/libs/agents/infrastructure/rda/rda_papi.cc:516]: (style) A >> pointer can >> not be negative so it is either pointless or an error to check if >> it is. >> [osaf/services/infrastructure/rde/include/role.h:34]: (style) >> Class 'Role' >> has a constructor with 1 argument that is not explicit. >> [osaf/services/infrastructure/rde/rde_mds.cc:240] -> >> [osaf/services/infrastructure/rde/rde_mds.cc:251]: (style) >> Variable 'rc' is >> reassigned a value before the old one has been used. >> [osaf/services/infrastructure/rde/rde_rda.cc:374] -> >> [osaf/services/infrastructure/rde/rde_rda.cc:381]: (style) >> Variable 'sockfd' >> is reassigned a value before the old one has been used. >> [osaf/tools/rde/rde_get_role.c:38] -> >> [osaf/tools/rde/rde_get_role.c:40]: >> (style) Variable 'ret_val' is reassigned a value before the old >> one has been >> used. [osaf/services/infrastructure/rde/rde_rda.cc:473]: (style) The >> function 'rde_rda_close' is never used. >> [osaf/services/infrastructure/rde/rde_rda.cc:417]: (style) The >> function >> 'rde_rda_sock_name' is never used. >> >> >> Complete diffstat: >> -- >> osaf/libs/agents/infrastructure/rda/rda_papi.cc| 13 + >> osaf/services/infrastructure/rde/include/rde_rda.h | 2 -- >> osaf/services/infrastructure/rde/include/role.h| 2 +- >> osaf/services/infrastructure/rde/rde_mds.cc| 3 +-- >> osaf/services/infrastructure/rde/rde_rda.cc| 58 >> +- >> osaf/tools/rde/rde_get_role.c | 3 +-- >> 6 files changed, 9 insertions(+), 72 deletions(-) >> >> >> Testing Commands: >> - >> make cppcheck >> >> >> Testing, Expected Results: >> -- >> cppcheck version 1.74 should not report any warnings in the RDE service >> >> >> Conditions of Submission: >> - >> Ack from reviewer(s) >> >> >> Arch Built StartedLinux distro >> --- >> mipsn n >> mips64 n n >> x86 n n >> x86_64 y y >> powerpc n n >> powerpc64 n n >> >> >> Reviewer Checklist: >> --- >> [Submitters: make sure that your review doesn't trigger any checkmarks!] >> >> >> Your checkin has not passed review because (see checked entries): >> >> ___ Your RR template is generally incomplete; it has too many blank >> entries >> that need proper data filled in. >> >> ___ You have failed to nominate the proper persons for review and push. >> >> ___ Your patches do not have proper short+long header >> >> ___ You have grammar/spelling in your header that is unacceptable. >> >> ___ You have exceeded a sensible line length in your >> headers/comm
Re: [devel] [PATCH 0 of 5] Review Request for base: Fix cppcheck warnings [#1879]
Ack with the following comment to take care. Please clean in PLM too.. /osaf/services/saf/plmsv/plms/plms_main.c: params.info_size = 0;/ /osaf/services/saf/plmsv/plms/plms_main.c: params.info_size = 0;/ /osaf/services/saf/plmsv/plms/plms_main.c: params.info_size = 0;/ /osaf/services/saf/plmsv/plms/plms_main.c: params.info_size = 0;/ /osaf/services/saf/plmsv/plms/plms_main.c: params.info_size = 0;/ /osaf/services/saf/plmsv/plms/plms_main.c: params.info_size = 0;/ Thanks, Ramesh. On 6/15/2016 8:21 PM, Anders Widell wrote: > Summary: base: Fix cppcheck warnings [#1879] > Review request for Trac Ticket(s): 1879 > Peer Reviewer(s): Ramesh > Pull request to: > Affected branch(es): default(5.1) > Development branch: default > > > Impacted area Impact y/n > > Docsn > Build systemn > RPM/packaging n > Configuration files n > Startup scripts n > SAF servicesn > OpenSAF servicesn > Core libraries y > Samples n > Tests n > Other n > > > Comments (indicate scope for each "y" above): > - > > changeset 5231c1f8ebff0ffb4c519f4d085241a3296de202 > Author: Anders Widell > Date: Wed, 15 Jun 2016 16:35:19 +0200 > > build: Update cppcheck target options [#1879] > > * Use inline suppressions instead of listing them on the command line > * Enable the gnu and posix libraries > * Remove unnecessary defines > > changeset 12731334579982e4be65f21d52a260bbe8c9487d > Author: Anders Widell > Date: Wed, 15 Jun 2016 16:35:25 +0200 > > amf: Remove unused info_size patricia tree parameter [#1879] > > changeset 239129245d4a1ec851db40e1c08c81918cde9aad > Author: Anders Widell > Date: Wed, 15 Jun 2016 16:35:30 +0200 > > lck: Remove unused info_size patricia tree parameter [#1879] > > changeset 4c6b2b8d1074bc62afa185a949e474ccd3d235b3 > Author: Anders Widell > Date: Wed, 15 Jun 2016 16:35:34 +0200 > > msg: Remove unused info_size patricia tree parameter [#1879] > > changeset 7766ef7bf0a97dfaf0b206d36967aeaddb140b8f > Author: Anders Widell > Date: Wed, 15 Jun 2016 16:44:54 +0200 > > base: Fix cppcheck warnings [#1879] > > The following warnings, reported by cppcheck version 1.74, have been > fixed: > > [osaf/libs/core/common/daemon.c:212]: (style) The scope of the variable > 'plibc_prctl' can be reduced. [osaf/libs/core/common/daemon.c:214]: > (style) > The scope of the variable 'pid' can be reduced. > [osaf/libs/core/common/daemon.c:214]: (style) The scope of the variable > 'sid' can be reduced. [osaf/libs/core/common/daemon.c:505]: (style) The > scope of the variable 'bt_filename_size' can be reduced. > [osaf/libs/core/common/daemon.c:507]: (style) The scope of the variable > 'time_string' can be reduced. [osaf/libs/core/common/daemon.c:510]: > (style) > The scope of the variable 'i' can be reduced. > [osaf/libs/core/common/daemon.c:340]: (portability) Non reentrant > function > 'getpwnam' called. For threadsafe applications it is recommended to use > the > reentrant replacement function 'getpwnam_r'. > [osaf/libs/core/common/daemon.c:533]: (portability) Non reentrant > function > 'localtime' called. For threadsafe applications it is recommended to > use the > reentrant replacement function 'localtime_r'. > [osaf/libs/core/common/daemon.c:256]: (error) Uninitialized variable: > param > [osaf/libs/core/common/daemon.c:528]: (error) Uninitialized variable: > time_string [osaf/libs/core/common/daemon.c:539]: (error) Uninitialized > variable: time_string [osaf/libs/core/common/ncs_main_pub.c:178] -> > [osaf/libs/core/common/ncs_main_pub.c:180]: (style) Variable 'rc' is > reassigned a value before the old one has been used. > [osaf/libs/core/common/ncs_main_pub.c:315] -> > [osaf/libs/core/common/ncs_main_pub.c:317]: (style) Variable 'rc' is > reassigned a value before the old one has been used. > [osaf/libs/core/common/ncs_main_pub.c:714]: (style) The scope of the > variable 'p_field' can be reduced. > [osaf/libs/core/common/ncs_main_pub.c:794]: (style) The scope of the > variable 'tmp' can be reduced. > [osaf/libs/core/common/ncs_main_pub.c:129]: > (style) struct member 'ncs_main_pub_cb::lock_create' is never used. > [osaf/libs/core/common/ncs_main_pub.c:693]: (style) Variable 'res' is > assigned a value that is never used. > [osaf/libs/core/common/nid_start_util.c:54]: (warning) fscanf() without > field width limits can crash with huge input data. > [osaf/libs/core/common/osaf_extended_name.c:183]: (error) Memory is > allocated but not initialized: p
Re: [devel] [PATCH 1 of 1] rde: Fix cppcheck warnings [#1870]
Ack. Thanks, Ramesh. On 6/9/2016 3:59 PM, Anders Widell wrote: > osaf/libs/agents/infrastructure/rda/rda_papi.cc| 13 +--- > osaf/services/infrastructure/rde/include/rde_rda.h | 2 - > osaf/services/infrastructure/rde/include/role.h| 2 +- > osaf/services/infrastructure/rde/rde_mds.cc| 3 +- > osaf/services/infrastructure/rde/rde_rda.cc| 58 > +- > osaf/tools/rde/rde_get_role.c | 3 +- > 6 files changed, 9 insertions(+), 72 deletions(-) > > > The following warnings, reported by cppcheck version 1.74, have been fixed: > > [osaf/libs/agents/infrastructure/rda/rda_papi.cc:300]: (style) C-style > pointer casting > [osaf/libs/agents/infrastructure/rda/rda_papi.cc:347] -> > [osaf/libs/agents/infrastructure/rda/rda_papi.cc:356]: (style) Variable 'rc' > is reassigned a value before the old one has been used. > [osaf/libs/agents/infrastructure/rda/rda_papi.cc:410] -> > [osaf/libs/agents/infrastructure/rda/rda_papi.cc:421]: (style) Variable 'rc' > is reassigned a value before the old one has been used. > [osaf/libs/agents/infrastructure/rda/rda_papi.cc:585] -> > [osaf/libs/agents/infrastructure/rda/rda_papi.cc:593]: (style) Variable 'rc' > is reassigned a value before the old one has been used. > [osaf/libs/agents/infrastructure/rda/rda_papi.cc:516]: (style) A pointer can > not be negative so it is either pointless or an error to check if it is. > [osaf/services/infrastructure/rde/include/role.h:34]: (style) Class 'Role' > has a constructor with 1 argument that is not explicit. > [osaf/services/infrastructure/rde/rde_mds.cc:240] -> > [osaf/services/infrastructure/rde/rde_mds.cc:251]: (style) Variable 'rc' is > reassigned a value before the old one has been used. > [osaf/services/infrastructure/rde/rde_rda.cc:374] -> > [osaf/services/infrastructure/rde/rde_rda.cc:381]: (style) Variable 'sockfd' > is reassigned a value before the old one has been used. > [osaf/tools/rde/rde_get_role.c:38] -> [osaf/tools/rde/rde_get_role.c:40]: > (style) Variable 'ret_val' is reassigned a value before the old one has been > used. > [osaf/services/infrastructure/rde/rde_rda.cc:473]: (style) The function > 'rde_rda_close' is never used. > [osaf/services/infrastructure/rde/rde_rda.cc:417]: (style) The function > 'rde_rda_sock_name' is never used. > > diff --git a/osaf/libs/agents/infrastructure/rda/rda_papi.cc > b/osaf/libs/agents/infrastructure/rda/rda_papi.cc > --- a/osaf/libs/agents/infrastructure/rda/rda_papi.cc > +++ b/osaf/libs/agents/infrastructure/rda/rda_papi.cc > @@ -297,7 +297,7 @@ static PCSRDA_RETURN_CODE pcs_rda_unreg_ > if (!task_cb) > return rc; > > - rda_callback_cb = (RDA_CALLBACK_CB *) task_cb; > + rda_callback_cb = static_cast(task_cb); > rda_callback_cb->task_terminate = true; > > /* > @@ -344,7 +344,6 @@ static PCSRDA_RETURN_CODE pcs_rda_unreg_ >* Notes : None > > */ > static PCSRDA_RETURN_CODE pcs_rda_set_role(PCS_RDA_ROLE role) { > - PCSRDA_RETURN_CODE rc = PCSRDA_RC_SUCCESS; > int sockfd; > char msg[64] = { 0 }; > int value = -1; > @@ -353,7 +352,7 @@ static PCSRDA_RETURN_CODE pcs_rda_set_ro > /* > ** Connect > */ > - rc = rda_connect(&sockfd); > + PCSRDA_RETURN_CODE rc = rda_connect(&sockfd); > if (rc != PCSRDA_RC_SUCCESS) { > return rc; > } > @@ -407,7 +406,6 @@ static PCSRDA_RETURN_CODE pcs_rda_set_ro >* Notes : None > > */ > static PCSRDA_RETURN_CODE pcs_rda_get_role(PCS_RDA_ROLE *role) { > - PCSRDA_RETURN_CODE rc = PCSRDA_RC_SUCCESS; > int sockfd; > char msg[64] = { 0 }; > int value = -1; > @@ -418,7 +416,7 @@ static PCSRDA_RETURN_CODE pcs_rda_get_ro > /* > ** Connect > */ > - rc = rda_connect(&sockfd); > + PCSRDA_RETURN_CODE rc = rda_connect(&sockfd); > if (rc != PCSRDA_RC_SUCCESS) { > return rc; > } > @@ -513,7 +511,7 @@ static PCSRDA_RETURN_CODE rda_connect(in > ** Create the socket descriptor > */ > *sockfd = socket(AF_UNIX, SOCK_STREAM, 0); > - if (sockfd < 0) { > + if (*sockfd < 0) { > return PCSRDA_RC_IPC_CREATE_FAILED; > } > > @@ -582,7 +580,6 @@ static PCSRDA_RETURN_CODE rda_disconnect > > */ > static PCSRDA_RETURN_CODE rda_callback_req(int sockfd) { > char msg[64] = { 0 }; > - PCSRDA_RETURN_CODE rc = PCSRDA_RC_SUCCESS; > int value = -1; > RDE_RDA_CMD_TYPE cmd_type = RDE_RDA_UNKNOWN; > > @@ -590,7 +587,7 @@ static PCSRDA_RETURN_CODE rda_callback_r > ** Send callback reg request messgae > */ > sprintf(msg, "%d", RDE_RDA_REG_CB_REQ); > - rc = rda_write_msg(sockfd, msg); > + PCSRDA_RETURN_CODE rc = rda_write_msg(sockfd, msg); > if (rc != PCSRDA_RC_SUCCESS) { >
Re: [devel] [PATCH 2 of 2] rde: Fix cpplint warnings [#1871]
Ack. Thanks, Ramesh. On 6/9/2016 8:00 PM, Anders Widell wrote: > osaf/libs/agents/infrastructure/rda/rda.h | 48 +-- > osaf/libs/agents/infrastructure/rda/rda_papi.cc | 61 > +- > osaf/libs/core/include/rda_papi.h | 10 +- > osaf/services/infrastructure/rde/Makefile.am | 1 + > osaf/services/infrastructure/rde/include/rde_amf.h| 20 +--- > osaf/services/infrastructure/rde/include/rde_cb.h | 37 +++- > osaf/services/infrastructure/rde/include/rde_rda.h| 8 +- > osaf/services/infrastructure/rde/include/rde_rda_common.h | 10 +- > osaf/services/infrastructure/rde/include/role.h | 18 ++-- > osaf/services/infrastructure/rde/rde_amf.cc | 31 +++--- > osaf/services/infrastructure/rde/rde_main.cc | 46 +- > osaf/services/infrastructure/rde/rde_mds.cc | 24 ++-- > osaf/services/infrastructure/rde/rde_rda.cc | 23 ++-- > osaf/services/infrastructure/rde/role.cc | 25 +++-- > 14 files changed, 162 insertions(+), 200 deletions(-) > > > The following cpplint warnings have been fixed: > > osaf/libs/core/include/rda_papi.h:30: #ifndef header guard has wrong style, > please use: OSAF_LIBS_CORE_INCLUDE_RDA_PAPI_H_ [build/header_guard] [5] > osaf/libs/core/include/rda_papi.h:141: #endif line should be "#endif // > OSAF_LIBS_CORE_INCLUDE_RDA_PAPI_H_" [build/header_guard] [5] > osaf/libs/core/include/rda_papi.h:38: Include the directory when naming .h > files [build/include] [4] > Done processing osaf/libs/core/include/rda_papi.h > osaf/libs/agents/infrastructure/rda/rda.h:30: #ifndef header guard has wrong > style, please use: OSAF_LIBS_AGENTS_INFRASTRUCTURE_RDA_RDA_H_ > [build/header_guard] [5] > osaf/libs/agents/infrastructure/rda/rda.h:85: #endif line should be "#endif > // OSAF_LIBS_AGENTS_INFRASTRUCTURE_RDA_RDA_H_" [build/header_guard] [5] > osaf/libs/agents/infrastructure/rda/rda.h:37: Found C system header after > C++ system header. Should be: rda.h, c system, c++ system, other. > [build/include_order] [4] > osaf/libs/agents/infrastructure/rda/rda.h:39: Found C system header after > C++ system header. Should be: rda.h, c system, c++ system, other. > [build/include_order] [4] > osaf/libs/agents/infrastructure/rda/rda.h:40: Found C system header after > C++ system header. Should be: rda.h, c system, c++ system, other. > [build/include_order] [4] > osaf/libs/agents/infrastructure/rda/rda.h:41: Found C system header after > C++ system header. Should be: rda.h, c system, c++ system, other. > [build/include_order] [4] > osaf/libs/agents/infrastructure/rda/rda.h:42: Found C system header after > C++ system header. Should be: rda.h, c system, c++ system, other. > [build/include_order] [4] > osaf/libs/agents/infrastructure/rda/rda.h:43: Found C system header after > C++ system header. Should be: rda.h, c system, c++ system, other. > [build/include_order] [4] > osaf/libs/agents/infrastructure/rda/rda.h:45: Include the directory when > naming .h files [build/include] [4] > osaf/libs/agents/infrastructure/rda/rda.h:46: Include the directory when > naming .h files [build/include] [4] > osaf/libs/agents/infrastructure/rda/rda.h:48: Include the directory when > naming .h files [build/include] [4] > osaf/libs/agents/infrastructure/rda/rda.h:49: Include the directory when > naming .h files [build/include] [4] > osaf/libs/agents/infrastructure/rda/rda.h:50: Include the directory when > naming .h files [build/include] [4] > osaf/libs/agents/infrastructure/rda/rda.h:51: Include the directory when > naming .h files [build/include] [4] > osaf/libs/agents/infrastructure/rda/rda.h:52: Include the directory when > naming .h files [build/include] [4] > osaf/libs/agents/infrastructure/rda/rda.h:53: Include the directory when > naming .h files [build/include] [4] > osaf/libs/agents/infrastructure/rda/rda.h:54: Include the directory when > naming .h files [build/include] [4] > osaf/libs/agents/infrastructure/rda/rda.h:55: Include the directory when > naming .h files [build/include] [4] > osaf/libs/agents/infrastructure/rda/rda.h:56: Include the directory when > naming .h files [build/include] [4] > osaf/libs/agents/infrastructure/rda/rda.h:57: Include the directory when > naming .h files [build/include] [4] > osaf/libs/agents/infrastructure/rda/rda.h:58: Include the directory when > naming .h files [build/include] [4] > osaf/libs/agents/infrastructure/rda/rda.h:60: Include the directory when > naming .h files [build/include] [4] > osaf/libs/agents/infrastructure/rda/rda.h:61: Include the directory when > naming .h files [build/include] [4] > osaf/libs/agents/infrastructure/rda/rda.h:61: "ncssysf_lck.h" already > included at osaf/libs/agents/infrastructure/rda/rda.h:50 [build/include] [4] > osaf/libs/agents/infrastructure/rda/
Re: [devel] [PATCH 1 of 1] libs/core: add support for long DN in sanamet encode & decode functions [#1674]
Hi Gary, will try to post my comments by tomorrow at max. Thanks, Ramesh. On 7/4/2016 1:56 PM, Gary Lee wrote: > Just a friendly reminder to review this patch. > > I would like to push the patch, as we’re planning to send out the long DN > patches for AMF this week, which is based on this proposal. > > Thanks > Gary > >> On 23 Jun 2016, at 4:17 PM, Gary Lee wrote: >> >> osaf/libs/core/common/saf_edu.c| 34 ++ >> osaf/libs/core/include/ncsencdec_pub.h |3 + >> osaf/libs/core/leap/hj_enc.c | 100 >> ++-- >> 3 files changed, 102 insertions(+), 35 deletions(-) >> >> >> Currently, ncs_edp_sanamet encodes a SaNameT by storing the length in 2 >> bytes, >> followed by a fixed char array of length SA_MAX_NAME_LENGTH. >> >> This patch adds long DN supoprt by: >> >> if length < SA_MAX_NAME_LENGTH, encode as present >> if length >= SA_MAX_NAME_LENGTH, encode as a variable string like >> ncs_edp_string >> >> diff --git a/osaf/libs/core/common/saf_edu.c >> b/osaf/libs/core/common/saf_edu.c >> --- a/osaf/libs/core/common/saf_edu.c >> +++ b/osaf/libs/core/common/saf_edu.c >> @@ -42,6 +42,7 @@ >> #include "saf_mem.h" >> #include "ncs_edu_pub.h" >> #include "ncs_saf_edu.h" >> +#include "osaf_extended_name.h" >> >> /* >> >> @@ -57,36 +58,15 @@ >> uint32_t ncs_edp_sanamet(EDU_HDL *hdl, EDU_TKN *edu_tkn, >>NCSCONTEXT ptr, uint32_t *ptr_data_len, EDU_BUF_ENV >> *buf_env, EDP_OP_TYPE op, EDU_ERR *o_err) >> { >> -uint32_t rc = NCSCC_RC_SUCCESS; >> -SaNameT *struct_ptr = NULL, **d_ptr = NULL; >> - >> -EDU_INST_SET saname_rules[] = { >> -{EDU_START, ncs_edp_sanamet, 0, 0, 0, sizeof(SaNameT), 0, NULL}, >> -{EDU_EXEC, m_NCS_EDP_SAUINT16T, 0, 0, 0, >> - (long)&((SaNameT *)0)->length, 0, NULL}, >> -{EDU_EXEC, ncs_edp_uns8, EDQ_ARRAY, 0, 0, >> - (long)&((SaNameT *)0)->value, SA_MAX_NAME_LENGTH, NULL}, >> -{EDU_END, 0, 0, 0, 0, 0, 0, NULL}, >> -}; >> - >> if (op == EDP_OP_TYPE_ENC) { >> -struct_ptr = (SaNameT *)ptr; >> +const SaNameT *name = ptr; >> +osaf_encode_sanamet(buf_env->info.uba, name); >> } else if (op == EDP_OP_TYPE_DEC) { >> -d_ptr = (SaNameT **)ptr; >> -if (*d_ptr == NULL) { >> -*d_ptr = m_MMGR_ALLOC_EDP_SANAMET; >> -if (*d_ptr == NULL) { >> -*o_err = EDU_ERR_MEM_FAIL; >> -return NCSCC_RC_FAILURE; >> -} >> -} >> -memset(*d_ptr, '\0', sizeof(SaNameT)); >> -struct_ptr = *d_ptr; >> -} else { >> -struct_ptr = ptr; >> +SaNameT *name = *(SaNameT**)ptr; >> +osaf_decode_sanamet(buf_env->info.uba, name); >> } >> -rc = m_NCS_EDU_RUN_RULES(hdl, edu_tkn, saname_rules, struct_ptr, >> ptr_data_len, buf_env, op, o_err); >> -return rc; >> + >> +return NCSCC_RC_SUCCESS; >> } >> >> /* >> diff --git a/osaf/libs/core/include/ncsencdec_pub.h >> b/osaf/libs/core/include/ncsencdec_pub.h >> --- a/osaf/libs/core/include/ncsencdec_pub.h >> +++ b/osaf/libs/core/include/ncsencdec_pub.h >> @@ -153,6 +153,9 @@ void osaf_encode_uint64(NCS_UBAID *ub, u >> void osaf_decode_uint64(NCS_UBAID *ub, uint64_t *to); >> void osaf_encode_sanamet(NCS_UBAID *ub, const SaNameT *name); >> void osaf_decode_sanamet(NCS_UBAID *ub, SaNameT *name); >> +void osaf_encode_sanamet_o2(NCS_UBAID *ub, SaConstStringT name); >> +void osaf_encode_saconststring(NCS_UBAID *ub, SaConstStringT str); >> +void osaf_decode_sastring(NCS_UBAID *ub, SaStringT* str); >> void osaf_encode_satimet(NCS_UBAID *ub, SaTimeT time); >> void osaf_decode_satimet(NCS_UBAID *ub, SaTimeT *time); >> void osaf_encode_bool(NCS_UBAID *ub, bool value); >> diff --git a/osaf/libs/core/leap/hj_enc.c b/osaf/libs/core/leap/hj_enc.c >> --- a/osaf/libs/core/leap/hj_enc.c >> +++ b/osaf/libs/core/leap/hj_enc.c >> @@ -42,6 +42,9 @@ >> >> *** >> */ >> +#ifndef SA_EXTENDED_NAME_SOURCE >> +#define SA_EXTENDED_NAME_SOURCE >> +#endif >> >> #include >> #include "ncs_osprm.h" >> @@ -49,6 +52,7 @@ >> #include "ncssysf_def.h" >> #include "ncssysf_mem.h" >> #include "ncs_svd.h" >> +#include "osaf_extended_name.h" >> >> /** A NULL os implies "count" number of zeros... >> **/ >> @@ -374,18 +378,49 @@ void osaf_decode_uint64(NCS_UBAID *ub, u >> >> void osaf_encode_sanamet(NCS_UBAID *ub, const SaNameT *name) >> { >> -int i; >> -osaf_encode_uint16(ub, name->length); >> -for (i = 0; i < SA_MAX_NAME_LENGTH; i++) >> -osaf_encode_uint8(ub, name->value[i]); >> +TRACE_ENTER(); >> + >> +SaConstStringT str = osaf_extended_name_borrow(nam
Re: [devel] [PATCH 1 of 1] libs/core: add support for long DN in sanamet encode & decode functions [#1674]
Ack. Code review only. Hope testing covers backward compatibility validations. Regards, Ramesh. On 7/4/2016 1:56 PM, Gary Lee wrote: > Just a friendly reminder to review this patch. > > I would like to push the patch, as we’re planning to send out the long DN > patches for AMF this week, which is based on this proposal. > > Thanks > Gary > >> On 23 Jun 2016, at 4:17 PM, Gary Lee wrote: >> >> osaf/libs/core/common/saf_edu.c| 34 ++ >> osaf/libs/core/include/ncsencdec_pub.h |3 + >> osaf/libs/core/leap/hj_enc.c | 100 >> ++-- >> 3 files changed, 102 insertions(+), 35 deletions(-) >> >> >> Currently, ncs_edp_sanamet encodes a SaNameT by storing the length in 2 >> bytes, >> followed by a fixed char array of length SA_MAX_NAME_LENGTH. >> >> This patch adds long DN supoprt by: >> >> if length < SA_MAX_NAME_LENGTH, encode as present >> if length >= SA_MAX_NAME_LENGTH, encode as a variable string like >> ncs_edp_string >> >> diff --git a/osaf/libs/core/common/saf_edu.c >> b/osaf/libs/core/common/saf_edu.c >> --- a/osaf/libs/core/common/saf_edu.c >> +++ b/osaf/libs/core/common/saf_edu.c >> @@ -42,6 +42,7 @@ >> #include "saf_mem.h" >> #include "ncs_edu_pub.h" >> #include "ncs_saf_edu.h" >> +#include "osaf_extended_name.h" >> >> /* >> >> @@ -57,36 +58,15 @@ >> uint32_t ncs_edp_sanamet(EDU_HDL *hdl, EDU_TKN *edu_tkn, >>NCSCONTEXT ptr, uint32_t *ptr_data_len, EDU_BUF_ENV >> *buf_env, EDP_OP_TYPE op, EDU_ERR *o_err) >> { >> -uint32_t rc = NCSCC_RC_SUCCESS; >> -SaNameT *struct_ptr = NULL, **d_ptr = NULL; >> - >> -EDU_INST_SET saname_rules[] = { >> -{EDU_START, ncs_edp_sanamet, 0, 0, 0, sizeof(SaNameT), 0, NULL}, >> -{EDU_EXEC, m_NCS_EDP_SAUINT16T, 0, 0, 0, >> - (long)&((SaNameT *)0)->length, 0, NULL}, >> -{EDU_EXEC, ncs_edp_uns8, EDQ_ARRAY, 0, 0, >> - (long)&((SaNameT *)0)->value, SA_MAX_NAME_LENGTH, NULL}, >> -{EDU_END, 0, 0, 0, 0, 0, 0, NULL}, >> -}; >> - >> if (op == EDP_OP_TYPE_ENC) { >> -struct_ptr = (SaNameT *)ptr; >> +const SaNameT *name = ptr; >> +osaf_encode_sanamet(buf_env->info.uba, name); >> } else if (op == EDP_OP_TYPE_DEC) { >> -d_ptr = (SaNameT **)ptr; >> -if (*d_ptr == NULL) { >> -*d_ptr = m_MMGR_ALLOC_EDP_SANAMET; >> -if (*d_ptr == NULL) { >> -*o_err = EDU_ERR_MEM_FAIL; >> -return NCSCC_RC_FAILURE; >> -} >> -} >> -memset(*d_ptr, '\0', sizeof(SaNameT)); >> -struct_ptr = *d_ptr; >> -} else { >> -struct_ptr = ptr; >> +SaNameT *name = *(SaNameT**)ptr; >> +osaf_decode_sanamet(buf_env->info.uba, name); >> } >> -rc = m_NCS_EDU_RUN_RULES(hdl, edu_tkn, saname_rules, struct_ptr, >> ptr_data_len, buf_env, op, o_err); >> -return rc; >> + >> +return NCSCC_RC_SUCCESS; >> } >> >> /* >> diff --git a/osaf/libs/core/include/ncsencdec_pub.h >> b/osaf/libs/core/include/ncsencdec_pub.h >> --- a/osaf/libs/core/include/ncsencdec_pub.h >> +++ b/osaf/libs/core/include/ncsencdec_pub.h >> @@ -153,6 +153,9 @@ void osaf_encode_uint64(NCS_UBAID *ub, u >> void osaf_decode_uint64(NCS_UBAID *ub, uint64_t *to); >> void osaf_encode_sanamet(NCS_UBAID *ub, const SaNameT *name); >> void osaf_decode_sanamet(NCS_UBAID *ub, SaNameT *name); >> +void osaf_encode_sanamet_o2(NCS_UBAID *ub, SaConstStringT name); >> +void osaf_encode_saconststring(NCS_UBAID *ub, SaConstStringT str); >> +void osaf_decode_sastring(NCS_UBAID *ub, SaStringT* str); >> void osaf_encode_satimet(NCS_UBAID *ub, SaTimeT time); >> void osaf_decode_satimet(NCS_UBAID *ub, SaTimeT *time); >> void osaf_encode_bool(NCS_UBAID *ub, bool value); >> diff --git a/osaf/libs/core/leap/hj_enc.c b/osaf/libs/core/leap/hj_enc.c >> --- a/osaf/libs/core/leap/hj_enc.c >> +++ b/osaf/libs/core/leap/hj_enc.c >> @@ -42,6 +42,9 @@ >> >> *** >> */ >> +#ifndef SA_EXTENDED_NAME_SOURCE >> +#define SA_EXTENDED_NAME_SOURCE >> +#endif >> >> #include >> #include "ncs_osprm.h" >> @@ -49,6 +52,7 @@ >> #include "ncssysf_def.h" >> #include "ncssysf_mem.h" >> #include "ncs_svd.h" >> +#include "osaf_extended_name.h" >> >> /** A NULL os implies "count" number of zeros... >> **/ >> @@ -374,18 +378,49 @@ void osaf_decode_uint64(NCS_UBAID *ub, u >> >> void osaf_encode_sanamet(NCS_UBAID *ub, const SaNameT *name) >> { >> -int i; >> -osaf_encode_uint16(ub, name->length); >> -for (i = 0; i < SA_MAX_NAME_LENGTH; i++) >> -osaf_encode_uint8(ub, name->value[i]); >> +TRACE_ENTER(); >> + >> +SaConstStringT str = osaf_ex
Re: [devel] [PATCH 1 of 1] base: Use INFO log priority level when failing to use real-time priority [#1923]
Ack. Thanks, Ramesh. On 7/20/2016 7:53 PM, Anders Widell wrote: > osaf/libs/core/leap/os_defs.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > > Use INFO level syslog priority when we are unable to set real-time scheduling > priority. Otherwise syslog can be filled up with warning messages e.g. if an > opensaf command-line tool is used many times. > > diff --git a/osaf/libs/core/leap/os_defs.c b/osaf/libs/core/leap/os_defs.c > --- a/osaf/libs/core/leap/os_defs.c > +++ b/osaf/libs/core/leap/os_defs.c > @@ -224,7 +224,7 @@ unsigned int ncs_os_task(NCS_OS_TASK *ta > (void *(*)(void > *))task->info.create.i_entry_point, > task->info.create.i_ep_arg); > if (rc == EPERM && policy != SCHED_OTHER) { > - LOG_WA("pthread_create failed with EPERM, " > + LOG_IN("pthread_create failed with EPERM, " > "falling back to SCHED_OTHER policy " > "for %s", task->info.create.i_name); > policy = SCHED_OTHER; -- What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 1] rde: Change syslog priority from ER to WA when MDS send fails [#1907]
Ack. Thanks, Ramesh. On 7/8/2016 6:09 PM, Anders Widell wrote: > osaf/services/infrastructure/rde/rde_mds.cc | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > > RDE may fail to send MDS messages to its peer, e.g. when the peer node is > down. > This should not be considered an error and therefore the syslog messages > should > not have ER priority. The messages are now logged with WA priority. > > diff --git a/osaf/services/infrastructure/rde/rde_mds.cc > b/osaf/services/infrastructure/rde/rde_mds.cc > --- a/osaf/services/infrastructure/rde/rde_mds.cc > +++ b/osaf/services/infrastructure/rde/rde_mds.cc > @@ -276,7 +276,7 @@ uint32_t rde_mds_send(struct rde_msg *ms > > rc = ncsmds_api(&info); > if (NCSCC_RC_FAILURE == rc) { > - LOG_ER("Failed to send %s to %" PRIx64, rde_msg_name[msg->type], > + LOG_WA("Failed to send %s to %" PRIx64, rde_msg_name[msg->type], >to_dest); > base::Sleep(base::kOneHundredMilliseconds); > } else { -- ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 07 of 13] leap: support for SAF SaTimeT timeout variable in MDS transport [#1658]
Hi Mahesh, Good job! Ack with the following review comments. Not tested. * hj_tmr.c: rp_tmr_time_left_in_sec(time_t tmr_trig_at, *uint32**_t* tmr_value) ==> change uint32_t to int64_t. * ncs_tmr.h: #define m_RP_TMR_LOG_MSG(str, val) printf("%s :: %x\n", str, *(uint32_t*)val); ==> has to print int64_t value. * nodeinit.c: time_out = atoi(q);, ==> should be atoll(). * Minor comment: Following services code shall also need to update to int64_t. Hopefully svc owners can take care of them. osaf/services/saf/smfsv/smfnd/smfnd_evt.c: cmd_info.i_timeout_in_ms = i_timeout; osaf/services/saf/amf/amfnd/clc.cc: cmd_info.i_timeout_in_ms = (uint32_t)((clc_info->cmds[cmd_type - 1].timeout) / 100); osaf/services/saf/amf/amfnd/clc.cc: clc_info->cmds[cmd_type - 1].timeout, cmd_info.i_timeout_in_ms); * Also need to update test code accordingly osaf/libs/core/leap/tests/sysf_tmr_test.cc * Hopefully you will be taking care of validating these patches on 32-bit machines too?. Also, compiling them with GCC 6.1 version etc. Also, all the services owners need to review the service specific patch(es) of #1658. Best Regards, Ramesh. On 8/9/2016 11:45 AM, mahesh.va...@oracle.com wrote: > osaf/libs/core/common/include/osaf_poll.h| 4 ++-- > osaf/libs/core/common/include/osaf_secutil.h | 2 +- > osaf/libs/core/common/osaf_poll.c| 9 + > osaf/libs/core/common/osaf_secutil.c | 8 > osaf/libs/core/include/ncs_osprm.h | 2 +- > osaf/libs/core/include/ncs_tmr.h | 8 > osaf/libs/core/include/ncssysf_tmr.h | 4 ++-- > osaf/libs/core/leap/hj_tmr.c | 22 +++--- > osaf/libs/core/leap/include/sysf_exc_scr.h | 2 +- > osaf/libs/core/leap/sysf_tmr.c | 10 +- > osaf/services/infrastructure/nid/nodeinit.h | 2 +- > 11 files changed, 37 insertions(+), 36 deletions(-) > > > diff --git a/osaf/libs/core/common/include/osaf_poll.h > b/osaf/libs/core/common/include/osaf_poll.h > --- a/osaf/libs/core/common/include/osaf_poll.h > +++ b/osaf/libs/core/common/include/osaf_poll.h > @@ -43,7 +43,7 @@ extern "C" { >* >* The return value will always be in the range [0, i_nfds]. >*/ > -extern unsigned osaf_poll(struct pollfd* io_fds, nfds_t i_nfds, int > i_timeout); > +extern unsigned osaf_poll(struct pollfd* io_fds, nfds_t i_nfds, int64_t > i_timeout); > > /** >* @brief Wait for events on file descriptors > @@ -88,7 +88,7 @@ extern unsigned osaf_ppoll(struct pollfd >* >* The return value from this function will always be in the range [-1, 1]. >*/ > -extern int osaf_poll_one_fd(int i_fd, int i_timeout); > +extern int osaf_poll_one_fd(int i_fd, int64_t i_timeout); > > #ifdef __cplusplus > } > diff --git a/osaf/libs/core/common/include/osaf_secutil.h > b/osaf/libs/core/common/include/osaf_secutil.h > --- a/osaf/libs/core/common/include/osaf_secutil.h > +++ b/osaf/libs/core/common/include/osaf_secutil.h > @@ -58,7 +58,7 @@ extern "C" { >*/ > int osaf_auth_server_connect(const char *path, >const void *req_buf, size_t req_size, void > *resp_buf, size_t resp_size, > - int timeout); > + int64_t timeout); > > /** >* Type for callback installed on server side > diff --git a/osaf/libs/core/common/osaf_poll.c > b/osaf/libs/core/common/osaf_poll.c > --- a/osaf/libs/core/common/osaf_poll.c > +++ b/osaf/libs/core/common/osaf_poll.c > @@ -15,12 +15,13 @@ >* >*/ > > -#include "osaf_poll.h" > #include > #include > #include "osaf_time.h" > #include "osaf_utility.h" > #include "logtrace.h" > +#include "osaf_poll.h" > + > > static unsigned osaf_poll_no_timeout(struct pollfd* io_fds, nfds_t i_nfds); > > @@ -35,7 +36,7 @@ static unsigned osaf_poll_no_timeout(str > return result; > } > > -unsigned osaf_poll(struct pollfd* io_fds, nfds_t i_nfds, int i_timeout) > +unsigned osaf_poll(struct pollfd* io_fds, nfds_t i_nfds, int64_t i_timeout) > { > struct timespec timeout_ts; > if (i_timeout < 0) return osaf_poll_no_timeout(io_fds, i_nfds); > @@ -120,14 +121,14 @@ unsigned osaf_ppoll(struct pollfd* io_fd > return result; > } > > -int osaf_poll_one_fd(int i_fd, int i_timeout) > +int osaf_poll_one_fd(int i_fd, int64_t i_timeout) > { > struct pollfd set = { .fd = i_fd, .events = POLLIN, .revents = 0 }; > unsigned result; > result = osaf_poll(&set, 1, i_timeout); > if (result == 1) { > if ((set.revents & (POLLNVAL | POLLERR)) != 0) { > - LOG_ER("osaf_poll_one_fd(%d, %d) called from %p " > + LOG_ER("osaf_poll_one_fd(%d, %" PRId64 ") called from > %p " > "failed: revents=%hd", > i_fd, i_timeout, __builtin_r
Re: [devel] [PATCH 1 of 1] mds: Optimized the mds mutex locks code [#1338]
Ack. Thanks, Ramesh. On 8/26/2015 2:10 PM, mahesh.va...@oracle.com wrote: > osaf/libs/core/mds/mds_c_sndrcv.c | 40 > +- > 1 files changed, 2 insertions(+), 38 deletions(-) > > > Made centralized locks & unlock wherever possible, > for better debugging mds code and to reduces scope of locks & unlock code > errors > > diff --git a/osaf/libs/core/mds/mds_c_sndrcv.c > b/osaf/libs/core/mds/mds_c_sndrcv.c > --- a/osaf/libs/core/mds/mds_c_sndrcv.c > +++ b/osaf/libs/core/mds/mds_c_sndrcv.c > @@ -1804,7 +1804,6 @@ static uint32_t mds_subtn_tbl_add_disc_q > > /* Now wait till the timeout or an subscription result will come */ > > - osaf_mutex_unlock_ordie(&gl_mds_library_mutex); > > switch (req->i_sendtype) { > case MDS_SENDTYPE_SND: > @@ -1888,7 +1887,6 @@ static uint32_t mds_subtn_tbl_add_disc_q > break; > } > > - osaf_mutex_lock_ordie(&gl_mds_library_mutex); > > if (NCSCC_RC_SUCCESS != mds_check_for_mds_existence(&add_ptr->sel_obj, > env_hdl, fr_svc_id, req->i_to_svc)) { > m_MDS_LOG_ERR("MDS_SND_RCV: MDS entry doesnt exist\n"); > @@ -2465,9 +2463,7 @@ static uint32_t mcm_pvt_normal_svc_sndrs >get_svc_names(fr_svc_id), fr_svc_id, > get_svc_names(to_svc_id), to_svc_id, to_dest); > return status; > } else { > - osaf_mutex_unlock_ordie(&gl_mds_library_mutex); > if (NCSCC_RC_SUCCESS != mds_mcm_time_wait(&sync_queue->sel_obj, > req->info.sndrsp.i_time_to_wait)) { > - osaf_mutex_lock_ordie(&gl_mds_library_mutex); > /* This is for response for local dest */ > if (sync_queue->status == NCSCC_RC_SUCCESS) { > /* sucess case */ > @@ -2488,7 +2484,6 @@ static uint32_t mcm_pvt_normal_svc_sndrs > mcm_pvt_del_sync_send_entry((MDS_PWE_HDL)env_hdl, > fr_svc_id, xch_id, req->i_sendtype, 0); > return NCSCC_RC_REQ_TIMOUT; > } else { > - osaf_mutex_lock_ordie(&gl_mds_library_mutex); > > if (NCSCC_RC_SUCCESS != > mds_check_for_mds_existence(&sync_queue->sel_obj, env_hdl, fr_svc_id, > to_svc_id)) { > m_MDS_LOG_INFO("MDS_SND_RCV: MDS entry doesnt > exist\n"); > @@ -2579,10 +2574,12 @@ static uint32_t mds_await_active_tbl_del > > static uint32_t mds_mcm_time_wait(NCS_SEL_OBJ *sel_obj, uint32_t time_val) > { > + osaf_mutex_unlock_ordie(&gl_mds_library_mutex); > /* Now wait for the response to come */ > int count = osaf_poll_one_fd(sel_obj->rmv_obj, > time_val == 0 ? -1 : (time_val * 10)); > > + osaf_mutex_lock_ordie(&gl_mds_library_mutex); > if ((count == 0) || (count == -1)) { > /* Both for Timeout and Error Case */ > m_MDS_LOG_ERR("MDS_SND_RCV: Timeout or Error occured\n"); > @@ -2819,10 +2816,8 @@ static uint32_t mcm_pvt_normal_svc_sndra > m_MDS_ERR_PRINT_ANCHOR(msg_dest_adest); > return status; > } else { > - osaf_mutex_unlock_ordie(&gl_mds_library_mutex); > > if (NCSCC_RC_SUCCESS != mds_mcm_time_wait(&sync_queue->sel_obj, > req->info.sndrack.i_time_to_wait)) { > - osaf_mutex_lock_ordie(&gl_mds_library_mutex); > if (sync_queue->status == NCSCC_RC_SUCCESS) { > /* for local case */ > /* sucess case */ > @@ -2841,7 +2836,6 @@ static uint32_t mcm_pvt_normal_svc_sndra > msg_dest_adest); > return NCSCC_RC_REQ_TIMOUT; > } else { > - osaf_mutex_lock_ordie(&gl_mds_library_mutex); > > if (NCSCC_RC_SUCCESS != > mds_check_for_mds_existence(&sync_queue->sel_obj, env_hdl, fr_svc_id, > to_svc_id)) { > m_MDS_LOG_ERR("MDS_SND_RCV: MDS entry doesnt > exist\n"); > @@ -3057,9 +3051,7 @@ static uint32_t mcm_pvt_normal_svc_sndac > m_MDS_ERR_PRINT_ADEST(to_dest); > return status; > } else { > - osaf_mutex_unlock_ordie(&gl_mds_library_mutex); > if (NCSCC_RC_SUCCESS != mds_mcm_time_wait(&sync_queue->sel_obj, > req->info.sndack.i_time_to_wait)) { > - osaf_mutex_lock_ordie(&gl_mds_library_mutex); > if (sync_queue->status == NCSCC_RC_SUCCESS) { > /* sucess case */ > > mcm_pvt_del_sync_send_entry((MDS_PWE_HDL)env_hdl, fr_svc_id, xch_id, > req->i_sendtype, > @@ -3076,7 +3068,6 @@ static uint32_t mcm_pvt_normal_svc_sndac > mcm_pvt_del_sync_send_entry((MDS_PWE_HDL)env_hdl, > fr_svc_id, xch_id, req->i_sendtype, 0); > return NCSCC_RC_REQ_TIMO
Re: [devel] [PATCH 1 of 1] mds: fixed memory leak in opensf authenticate code [#1475]
Ack, not tested. Thanks, Ramesh. On 9/11/2015 2:32 PM, mahesh.va...@oracle.com wrote: > osaf/libs/core/mds/include/mds_dt2c.h | 2 ++ > osaf/libs/core/mds/mds_c_api.c| 2 ++ > osaf/libs/core/mds/mds_dt_common.c| 4 > 3 files changed, 8 insertions(+), 0 deletions(-) > > > Bug : > valgrind reported following memory leak in OpenSAF authenticate mechanism > MDS code > > > > IMM_vgdb_20150815_002240-==14199== 1,476,648 bytes in 20,509 blocks are > still reachable in loss record 240 of 240 > IMM_vgdb_20150815_002240-==14199==at 0x4C2A8B5: malloc (in > /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) > IMM_vgdb_20150815_002240-==14199==by 0x4E5451B: ncs_tmr_alloc > (sysf_tmr.c:649) > IMM_vgdb_20150815_002240-==14199==by 0x4E82B8B: start_mds_down_tmr > (mds_c_api.c:2492) > IMM_vgdb_20150815_002240-==14199==by 0x4E82B8B: mds_mcm_svc_down > (mds_c_api.c:2628) > IMM_vgdb_20150815_002240-==14199==by 0x4E8CD5E: > mdtm_process_discovery_events (mds_dt_tipc.c:1012) > IMM_vgdb_20150815_002240-==14199==by 0x4E8D38D: > mdtm_process_recv_events (mds_dt_tipc.c:703) > IMM_vgdb_20150815_002240-==14199==by 0x56DF805: start_thread (in > /lib64/libpthread-2.11.3.so) > IMM_vgdb_20150815_002240-==14199==by 0x616864C: clone (in > /lib64/libc-2.11.3.so) > > > > Fix : > The timer introduce as part of Ticket #1050 (amfnd sometimes fails to > start due to ERR_LIBRARY from saImmOmInitialize) > was not freeing timer , now after timeout/expired destroyed/free is called > . > > diff --git a/osaf/libs/core/mds/include/mds_dt2c.h > b/osaf/libs/core/mds/include/mds_dt2c.h > --- a/osaf/libs/core/mds/include/mds_dt2c.h > +++ b/osaf/libs/core/mds/include/mds_dt2c.h > @@ -26,6 +26,7 @@ > #ifndef _MDS_DT2C_H > #define _MDS_DT2C_H > > +#include > #include > #include "mds_papi.h" > > @@ -268,6 +269,7 @@ typedef struct mds_tmr_req_info { > struct { > MDS_DEST adest; > MDS_SVC_ID svc_id; > + tmr_t tmr_id; > } down_event_tmr_info; > > } info; > diff --git a/osaf/libs/core/mds/mds_c_api.c b/osaf/libs/core/mds/mds_c_api.c > --- a/osaf/libs/core/mds/mds_c_api.c > +++ b/osaf/libs/core/mds/mds_c_api.c > @@ -2495,6 +2495,8 @@ static void start_mds_down_tmr(MDS_DEST > abort(); > } > > + tmr_req_info->info.down_event_tmr_info.tmr_id = tmr_id; > + > uint32_t tmr_hdl = ncshm_create_hdl(NCS_HM_POOL_ID_COMMON, > NCS_SERVICE_ID_COMMON, (NCSCONTEXT)(tmr_req_info)); > > diff --git a/osaf/libs/core/mds/mds_dt_common.c > b/osaf/libs/core/mds/mds_dt_common.c > --- a/osaf/libs/core/mds/mds_dt_common.c > +++ b/osaf/libs/core/mds/mds_dt_common.c > @@ -819,6 +819,10 @@ uint32_t mds_tmr_mailbox_processing(void > (void)mds_process_info_del(info); > free(info); > } > + > + if > (tmr_req_info->info.down_event_tmr_info.tmr_id != NULL) { > + > ncs_tmr_free(tmr_req_info->info.down_event_tmr_info.tmr_id); > + } > break; > } > default: -- ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 1] Opensaf : Optimized fcntl() call for sckts/fd FD_CLOEXEC [#1337]
Ack. Thanks, Ramesh. On 8/31/2015 11:22 AM, mahesh.va...@oracle.com wrote: > osaf/libs/core/leap/os_defs.c | 20 +--- > osaf/libs/core/leap/sysf_mem.c | 2 +- > osaf/libs/core/mds/mds_dt_tcp.c | 16 +--- > 3 files changed, 3 insertions(+), 35 deletions(-) > > > Since Linux 2.6.27, socketpair() supports the SOCK_NONBLOCK and SOCK_CLOEXEC > flags described in socket(2). > Linux glibc 2.7 introduced the e flag to cause a close-on-exec flag upon open. > So optimized the code, this is useful as it avoid a race condition between > fopen() and a subsequent call to fcntl(). > > diff --git a/osaf/libs/core/leap/os_defs.c b/osaf/libs/core/leap/os_defs.c > --- a/osaf/libs/core/leap/os_defs.c > +++ b/osaf/libs/core/leap/os_defs.c > @@ -1060,21 +1060,11 @@ uint32_t ncs_sel_obj_create(NCS_SEL_OBJ > int s_pair[2]; > int flags = 0; > > - osaf_mutex_lock_ordie(&s_cloexec_mutex); > - if (0 != socketpair(AF_UNIX, SOCK_STREAM, 0, s_pair)) { > + if (0 != socketpair(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0, s_pair)) { > syslog(LOG_ERR, "%s: socketpair failed - %s", __FUNCTION__, > strerror(errno)); > - osaf_mutex_unlock_ordie(&s_cloexec_mutex); > return NCSCC_RC_FAILURE; > } > > - flags = fcntl(s_pair[0], F_GETFD, 0); > - fcntl(s_pair[0], F_SETFD, (flags | FD_CLOEXEC)); > - > - flags = fcntl(s_pair[1], F_GETFD, 0); > - fcntl(s_pair[1], F_SETFD, (flags | FD_CLOEXEC)); > - > - osaf_mutex_unlock_ordie(&s_cloexec_mutex); > - > if (s_pair[0] > s_pair[1]) { > /* Ensure s_pair[1] is equal or greater */ > int temp = s_pair[0]; > @@ -1293,18 +1283,10 @@ int ncs_sel_obj_rmv_ind(NCS_SEL_OBJ *i_i > FILE *ncs_os_fopen(const char *fpath, const char *fmode) > { > FILE *fp = NULL; > - int flags = 0; > - osaf_mutex_lock_ordie(&s_cloexec_mutex); > fp = fopen(fpath, fmode); > if (fp == NULL) { > - osaf_mutex_unlock_ordie(&s_cloexec_mutex); > return NULL; > } > > - flags = fcntl(fileno(fp), F_GETFD, 0); > - fcntl(fileno(fp), F_SETFD, (flags | FD_CLOEXEC)); > - > - osaf_mutex_unlock_ordie(&s_cloexec_mutex); > - > return fp; > } > diff --git a/osaf/libs/core/leap/sysf_mem.c b/osaf/libs/core/leap/sysf_mem.c > --- a/osaf/libs/core/leap/sysf_mem.c > +++ b/osaf/libs/core/leap/sysf_mem.c > @@ -1917,7 +1917,7 @@ uint32_t sysf_pick_output(char *str, cha > FILE *file; > > if (fname != NULL) { > - if ((file = ncs_os_fopen(fname, "at")) == NULL) > + if ((file = ncs_os_fopen(fname, "ate")) == NULL) > return NCSCC_RC_FAILURE; > fprintf(file, "%s\n", str); > fclose(file); > diff --git a/osaf/libs/core/mds/mds_dt_tcp.c b/osaf/libs/core/mds/mds_dt_tcp.c > --- a/osaf/libs/core/mds/mds_dt_tcp.c > +++ b/osaf/libs/core/mds/mds_dt_tcp.c > @@ -81,7 +81,6 @@ uint32_t mdtm_process_recv_events_tcp(vo >*/ > uint32_t mds_mdtm_init_tcp(NODE_ID nodeid, uint32_t *mds_tcp_ref) > { > - uint32_t flags; > uint32_t sndbuf_size = 0; /* Send buffer size */ > uint32_t rcvbuf_size = 0; /* Receive buffer size */ > socklen_t optlen; /* Option length */ > @@ -125,7 +124,7 @@ uint32_t mds_mdtm_init_tcp(NODE_ID nodei > > /* Create the sockets required for Binding, Send, receive and Discovery > */ > > - tcp_cb->DBSRsock = socket(mds_socket_domain, SOCK_STREAM, 0); > + tcp_cb->DBSRsock = socket(mds_socket_domain, SOCK_STREAM|SOCK_CLOEXEC, > 0); > if (tcp_cb->DBSRsock < 0) { > syslog(LOG_ERR, "MDS:MDTM:TCP DBSRsock Socket creation failed > in MDTM_INIT err :%s", strerror(errno)); > return NCSCC_RC_FAILURE; > @@ -177,19 +176,6 @@ uint32_t mds_mdtm_init_tcp(NODE_ID nodei > return NCSCC_RC_FAILURE; > } > > - flags = fcntl(tcp_cb->DBSRsock, F_GETFD, 0); > - if ((flags < 0) || (flags > 1)) { > - syslog(LOG_ERR, "MDS:MDTM:TCP Unable to get the CLOEXEC Flag on > DBSRsock err :%s", strerror(errno)); > - close(tcp_cb->DBSRsock); > - return NCSCC_RC_FAILURE; > - } else { > - if (fcntl(tcp_cb->DBSRsock, F_SETFD, (flags | FD_CLOEXEC)) == > (-1)) { > - syslog(LOG_ERR, "MDS:MDTM:TCP Unable to set the CLOEXEC > Flag on DBSRsock err :%s", strerror(errno)); > - close(tcp_cb->DBSRsock); > - return NCSCC_RC_FAILURE; > - } > - } > - > tcp_cb->adest = ((uint64_t)(nodeid)) << 32; > tcp_cb->adest |= mdtm_pid; > tcp_cb->node_id = nodeid; -- ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 1] cpsv: raised track callback for non-collo ckpt section create/delete [#1305]
Ack with one comment. Please free() the memory allocated for ckpt_data.sec_id.id = m_MMGR_ALLOC_CPND_DEFAULT(id->idLen); Thanks, Ramesh. On 9/15/2015 3:01 PM, mahesh.va...@oracle.com wrote: > osaf/services/saf/cpsv/cpnd/cpnd_evt.c | 80 > +++-- > 1 files changed, 65 insertions(+), 15 deletions(-) > > > In current implementation of non-collocated checkpoint, If a checkpoint is > opened for the first time > by an application residing on a payload blade, the replicas will be created > on the local payload blade > and both the system controller nodes. In this case, the replica residing on > the payload blade is designated as active replica. > If a non-collocated checkpoint is opened for the first time by an application > residing on the system controller nodes, > the replica will be created only on the system controller blade. In this > case, this replica on a system controller node will act as the active replica. > If another application opens the same checkpoint from a payload node, the > checkpoint service will not create the replica on that node. > > Bug : > Based on current implementation for NON_COLLOCATED CHECKPOINT application , > if saCkptCheckpointTrackCallback is registered, > for saCkptCheckpointWrite() & saCkptSectionOverwrite() TrackCallback are > getting invoked properly , > but for saCkptSectionCreate( With Initial Data) & saCkptSectionDelete() the > TrackCallback is not getting invoked. > > Fix : > Now trackcallback will be raised even the replica is NOT residing on the > payload blade for > saCkptSectionCreate( With Initial Data) & saCkptSectionDelete() . > > diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c > b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c > --- a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c > +++ b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c > @@ -643,7 +643,7 @@ static uint32_t cpnd_evt_proc_ckpt_open( > ((cp_node->open_active_sync_tmr.is_active) && >(cp_node->open_active_sync_tmr.lcl_ckpt_hdl == > evt->info.openReq.lcl_ckpt_hdl))){ > send_evt.info.cpa.info.openRsp.error = > SA_AIS_ERR_TRY_AGAIN; > - LOG_ER("cpnd Open try again sync_tmr exist or ndrestart > for lcl_ckpt_hdl:%llx ckpt:%llx",evt->info.openReq.lcl_ckpt_hdl, client_hdl); > + LOG_NO("cpnd Open try again sync_tmr exist or ndrestart > for lcl_ckpt_hdl:%llx ckpt:%llx",evt->info.openReq.lcl_ckpt_hdl, client_hdl); > goto agent_rsp; > } > > @@ -2667,9 +2667,45 @@ static uint32_t cpnd_evt_proc_nd2nd_ckpt > evt->info.active_sec_creat.ckpt_id; > } > } > + } else if (evt->info.active_sec_creat.init_data != NULL) { > + > + if > (!m_CPND_IS_COLLOCATED_ATTR_SET(cp_node->create_attrib.creationFlags)) { > + SaCkptSectionIdT *id = > evt->info.active_sec_creat.sec_attri.sectionId; > + > + ckpt_data = m_MMGR_ALLOC_CPSV_CKPT_DATA; > + if (ckpt_data == NULL) { > + rc = NCSCC_RC_FAILURE; > + TRACE_4("cpnd ckpt data memory failed "); > + error = SA_AIS_ERR_NO_SPACE; > + goto nd_rsp; > + } > + > + memset(ckpt_data, '\0', sizeof(CPSV_CKPT_DATA)); > + > + ckpt_data->sec_id.idLen = id->idLen; > + ckpt_data->sec_id.id = NULL; > + if (id->idLen > 0) { > + ckpt_data->sec_id.id = > m_MMGR_ALLOC_CPND_DEFAULT(id->idLen); > + memcpy(ckpt_data->sec_id.id, id->id, > ckpt_data->sec_id.idLen); > + } > + > + ckpt_data->data = evt->info.active_sec_creat.init_data; > + ckpt_data->dataSize = > evt->info.active_sec_creat.init_size; > + ckpt_data->dataOffset = 0; > + > + memset(&ckpt_access, '\0', sizeof(CPSV_CKPT_ACCESS)); > + ckpt_access.ckpt_id = cp_node->ckpt_id; > + ckpt_access.lcl_ckpt_id = > evt->info.active_sec_creat.lcl_ckpt_id; > + ckpt_access.agent_mdest = > evt->info.active_sec_creat.agent_mdest; > + ckpt_access.num_of_elmts = 1; > + ckpt_access.data = ckpt_data; > + > + cpnd_proc_ckpt_arrival_info_ntfy(cb, cp_node, > &ckpt_access, sinfo); > + m_MMGR_FREE_CPSV_CKPT_DATA(ckpt_data); > + } > } > > - nd_rsp: > +nd_rsp: > send_evt.type = CPSV_EVT_TYPE_CPND; > send_evt.info.cpnd.type = CPSV_EVT_ND2ND_CKPT_SECT_ACTIVE_CREATE_RSP; > send_evt.info.cpnd.info.active_sec_creat_rsp.error = error; > @@ -2715,21 +2751,34 @@ static uint32_
Re: [devel] [PATCH 1 of 1] base: Honour the return code, when node_id file is not present [#1623]
Ack. Not tested. Regards, Ramesh. On 12/7/2015 2:59 PM, reddy.neelaka...@oracle.com wrote: > osaf/libs/core/common/ncs_main_pub.c | 4 +++- > 1 files changed, 3 insertions(+), 1 deletions(-) > > > when the ncs_leap_startup is called at initialization, it checks for node_id > file. If node_id file is not present, then ncs_util_get_sys_params will > return error. The error from ncs_util_get_sys_params is presently not > honoured. > > when the error is honoured, the opensaf/applications will not allow to > initialize if node_id file is not present. > > diff --git a/osaf/libs/core/common/ncs_main_pub.c > b/osaf/libs/core/common/ncs_main_pub.c > --- a/osaf/libs/core/common/ncs_main_pub.c > +++ b/osaf/libs/core/common/ncs_main_pub.c > @@ -778,7 +778,9 @@ uint32_t ncs_update_sys_param_args(void) > NCS_SYS_PARAMS sys_params; > > /* Get the system specific parameters */ > - ncs_util_get_sys_params(&sys_params); > + if(ncs_util_get_sys_params(&sys_params)!=NCSCC_RC_SUCCESS){ > + return NCSCC_RC_FAILURE; > + } > > /* Frame input arguments */ > ncs_get_sys_params_arg(&sys_params); -- Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140 ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 1] mbc: repost the message if the RED_UP event not yet arrived [#1606]
Ack. Thanks, Ramesh. On 1/5/2016 2:52 PM, reddy.neelaka...@oracle.com wrote: > osaf/libs/core/mbcsv/include/mbcsv_pwe_anc.h | 9 ++ > osaf/libs/core/mbcsv/mbcsv_mds.c | 4 +- > osaf/libs/core/mbcsv/mbcsv_peer.c| 39 > > osaf/libs/core/mbcsv/mbcsv_pwe_anc.c | 9 -- > 4 files changed, 50 insertions(+), 11 deletions(-) > > > When the mbcsv message peer info messages arrives faster than RED_UP messages, > then the problem described in the ticket will occur. > > Postpone/repost the peer messages if RED_UP event does not arrive. > > diff --git a/osaf/libs/core/mbcsv/include/mbcsv_pwe_anc.h > b/osaf/libs/core/mbcsv/include/mbcsv_pwe_anc.h > --- a/osaf/libs/core/mbcsv/include/mbcsv_pwe_anc.h > +++ b/osaf/libs/core/mbcsv/include/mbcsv_pwe_anc.h > @@ -38,6 +38,15 @@ > #include "mbcsv.h" > > /* > + * Peer list used for storing all the peers of this PWE. This is used > + * for brodcasting the message to all the peers. > + */ > +typedef struct { > +uint32_t pwe_hdl; /* Handle supplied by application > with OPEN call */ > +MBCSV_ANCHOR anchor; > +} MBCSV_PEER_KEY; > + > +/* >* Prototypes of PWE anchor. >*/ > uint32_t mbcsv_destroy_peer_list(void); > diff --git a/osaf/libs/core/mbcsv/mbcsv_mds.c > b/osaf/libs/core/mbcsv/mbcsv_mds.c > --- a/osaf/libs/core/mbcsv/mbcsv_mds.c > +++ b/osaf/libs/core/mbcsv/mbcsv_mds.c > @@ -365,7 +365,7 @@ uint32_t mbcsv_mds_rcv(NCSMDS_CALLBACK_I > msg->msg_type = MBCSV_EVT_INTERNAL; > > if (msg->info.peer_msg.type == MBCSV_EVT_INTERNAL_PEER_DISC) { > - send_pri = NCS_IPC_PRIORITY_VERY_HIGH; > + send_pri = NCS_IPC_PRIORITY_HIGH; > } else > send_pri = NCS_IPC_PRIORITY_NORMAL; > > @@ -453,7 +453,7 @@ uint32_t mbcsv_mds_evt(MDS_CALLBACK_SVC_ > > evt->info.mds_sub_evt.evt_type = svc_info.i_change; > > - if (NCSCC_RC_SUCCESS != m_MBCSV_SND_MSG(&mbx, evt, > NCS_IPC_PRIORITY_HIGH)) { > + if (NCSCC_RC_SUCCESS != m_MBCSV_SND_MSG(&mbx, evt, > NCS_IPC_PRIORITY_VERY_HIGH)) { > m_MMGR_FREE_MBCSV_EVT(evt); > TRACE_LEAVE2("ipc send failed"); > return NCSCC_RC_FAILURE; > diff --git a/osaf/libs/core/mbcsv/mbcsv_peer.c > b/osaf/libs/core/mbcsv/mbcsv_peer.c > --- a/osaf/libs/core/mbcsv/mbcsv_peer.c > +++ b/osaf/libs/core/mbcsv/mbcsv_peer.c > @@ -650,6 +650,10 @@ void mbcsv_set_peer_state(CKPT_INST *ckp > uint32_t mbcsv_process_peer_up_info(MBCSV_EVT *msg, CKPT_INST *ckpt, > uint8_t peer_up) > { > PEER_INST *peer; > + MBCSV_PEER_KEY key; > + SYSF_MBX mbx; > + MBCSV_EVT *evt; > + > TRACE_ENTER(); > > /* > @@ -677,6 +681,41 @@ uint32_t mbcsv_process_peer_up_info(MBCS > } > } > > + if (0 != (mbx = mbcsv_get_mbx(msg->rcvr_peer_key.pwe_hdl, > msg->rcvr_peer_key.svc_id))) { > + > + memset(&key, '\0', sizeof(MBCSV_PEER_KEY)); > + key.pwe_hdl = msg->rcvr_peer_key.pwe_hdl; > + key.anchor = msg->rcvr_peer_key.peer_anchor; > + > + m_NCS_LOCK(&mbcsv_cb.peer_list_lock, NCS_LOCK_WRITE); > + > + if (NULL == ncs_patricia_tree_get(&mbcsv_cb.peer_list, (const > uint8_t *)&key)) { > + > + if (NULL == (evt = m_MMGR_ALLOC_MBCSV_EVT)) { > + TRACE_LEAVE2("malloc failed"); > + m_NCS_UNLOCK(&mbcsv_cb.peer_list_lock, > NCS_LOCK_WRITE); > + return NCSCC_RC_FAILURE; > + } > + > + memset(evt, '\0', sizeof(MBCSV_EVT)); > + memcpy(evt, msg, sizeof(MBCSV_EVT)); > + > + TRACE_4("Still RED_UP event not arrived of the peer"); > + > + /* Again post the event, till RED_UP event arrives */ > + if (NCSCC_RC_SUCCESS != m_MBCSV_SND_MSG(&mbx, evt, > NCS_IPC_PRIORITY_HIGH)) { > + TRACE_LEAVE2("ipc send failed"); > + m_NCS_UNLOCK(&mbcsv_cb.peer_list_lock, > NCS_LOCK_WRITE); > + return NCSCC_RC_FAILURE; > + } > + > + m_NCS_UNLOCK(&mbcsv_cb.peer_list_lock, NCS_LOCK_WRITE); > + return NCSCC_RC_SUCCESS; > + } > + > + m_NCS_UNLOCK(&mbcsv_cb.peer_list_lock, NCS_LOCK_WRITE); > + } > + > if (NULL == (peer = mbcsv_add_new_peer(ckpt, > msg->rcvr_peer_key.peer_anchor))) { > TRACE_LEAVE2("failed to add new peer"); > return NCSCC_RC_FAILURE; > diff --git a/osaf/libs/core/mbcsv/mbcsv_pwe_anc.c > b/osaf/libs/core/mbcsv/mbcsv_pwe_anc.c > --- a/osaf/libs/core/mbcsv/mbcsv_pwe_anc.c > +++ b/osaf/libs/core/mbcsv/mbcsv_pwe_anc.c > @@ -32,15 +32,6 @@ > */ > #include "mbcs
Re: [devel] [PATCH 1 of 1] base: Treat failure to use real-time priorities as non-fatal [#1636]
Ack. Not tested. Thanks, Ramesh. On 1/12/2016 7:36 PM, Anders Widell wrote: > osaf/libs/core/common/daemon.c | 11 ++- > osaf/libs/core/leap/os_defs.c | 21 +++-- > 2 files changed, 29 insertions(+), 3 deletions(-) > > > OpenSAF will now fall back to the SCHED_OTHER scheduling policy when it fails > to set a real-time scheduling policy. > > diff --git a/osaf/libs/core/common/daemon.c b/osaf/libs/core/common/daemon.c > --- a/osaf/libs/core/common/daemon.c > +++ b/osaf/libs/core/common/daemon.c > @@ -254,7 +254,16 @@ void daemonize(int argc, char *argv[]) > policy = strtol(thread_policy, NULL, 0); > > param.sched_priority = prio_val; > - if (sched_setscheduler(0, policy, ¶m) == -1) { > + int result = sched_setscheduler(0, policy, ¶m); > + if (result == -1 && errno == EPERM && policy != SCHED_OTHER) { > + LOG_WA("sched_setscheduler failed with EPERM, falling back to " > + "SCHED_OTHER policy for %s", basename(argv[0])); > + policy = SCHED_OTHER; > + prio_val = sched_get_priority_min(policy); > + param.sched_priority = prio_val; > + result = sched_setscheduler(0, policy, ¶m); > + } > + if (result == -1) { > syslog(LOG_ERR, "Could not set scheduling class for %s", > strerror(errno)); > if( (!strncmp("osafamfwd", basename(argv[0]), 9)) || > (!strncmp("osafamfnd", basename(argv[0]), 9))) > { > diff --git a/osaf/libs/core/leap/os_defs.c b/osaf/libs/core/leap/os_defs.c > --- a/osaf/libs/core/leap/os_defs.c > +++ b/osaf/libs/core/leap/os_defs.c > @@ -52,6 +52,7 @@ > #include "ncssysf_def.h" > #include "osaf_utility.h" > #include "osaf_time.h" > +#include "logtrace.h" > > NCS_OS_LOCK gl_ncs_atomic_mtx; > #ifndef NDEBUG > @@ -222,12 +223,28 @@ unsigned int ncs_os_task(NCS_OS_TASK *ta > rc = pthread_create(task->info.create.o_handle, &attr, > (void *(*)(void > *))task->info.create.i_entry_point, > task->info.create.i_ep_arg); > + if (rc == EPERM && policy != SCHED_OTHER) { > + LOG_WA("pthread_create failed with EPERM, " > + "falling back to SCHED_OTHER policy " > + "for %s", task->info.create.i_name); > + policy = SCHED_OTHER; > + sp.sched_priority = > sched_get_priority_min(policy); > + rc = pthread_attr_setschedpolicy(&attr, policy); > + if (rc != 0) osaf_abort(rc); > + rc = pthread_attr_setschedparam(&attr, &sp); > + if (rc != 0) osaf_abort(rc); > + rc = pthread_create(task->info.create.o_handle, > + &attr, > + (void *(*)(void *))task->info.create. > + i_entry_point, > + task->info.create.i_ep_arg); > + } > if (rc != 0) { > if (policy == SCHED_RR || policy == SCHED_FIFO) > - syslog(LOG_ERR, "Creation of real-time > thread '%s' FAILED - '%s'", > + LOG_ER("Creation of real-time thread > '%s' FAILED - %s", > > task->info.create.i_name, strerror(rc)); > else > - syslog(LOG_ERR, "Creation of thread > '%s' FAILED - '%s'", > + LOG_ER("Creation of thread '%s' FAILED > - %s", > > task->info.create.i_name, strerror(rc)); > free(task->info.create.o_handle); > return NCSCC_RC_FAILURE; -- Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 1] mds: change Unix sock file osaf_dtm_intra_server path [#606]
Few comments: + rm -f $pkglocalstatedir/osaf_mdtm_process_* Where this "osaf_mdtm_process_*" file is getting created?, I did not see reference of this file in OpenSAF code. Please check. Also what about cleaning of the following file in TIPC case. + rm -f $pkglocalstatedir/osaf_dtm_intra_server Thanks, Ramesh. On 10/24/2013 10:41 AM, mahesh.va...@oracle.com wrote: > osaf/services/infrastructure/nid/scripts/opensafd.in | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > > diff --git a/osaf/services/infrastructure/nid/scripts/opensafd.in > b/osaf/services/infrastructure/nid/scripts/opensafd.in > --- a/osaf/services/infrastructure/nid/scripts/opensafd.in > +++ b/osaf/services/infrastructure/nid/scripts/opensafd.in > @@ -128,8 +128,8 @@ final_clean() { > else > # stop dtm, now all dependent services should be stopped > $pkgclcclidir/osaf-dtm stop >/dev/null 2>&1 > - rm -f /tmp/osaf_dtm_intra_server > - rm -f /tmp/osaf_mdtm_process_* > + rm -f $pkglocalstatedir/osaf_dtm_intra_server > + rm -f $pkglocalstatedir/osaf_mdtm_process_* > fi > > clean_shm -- October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 1] CLM: corrected memory leaks in clma (#604)
Ack. Thanks, Ramesh. On 10/23/2013 5:36 PM, reddy.neelaka...@oracle.com wrote: > osaf/libs/agents/saf/clma/clma_util.c | 4 > 1 files changed, 4 insertions(+), 0 deletions(-) > > > freed the memory when the clma callback is called with older version. > > diff --git a/osaf/libs/agents/saf/clma/clma_util.c > b/osaf/libs/agents/saf/clma/clma_util.c > --- a/osaf/libs/agents/saf/clma/clma_util.c > +++ b/osaf/libs/agents/saf/clma/clma_util.c > @@ -423,6 +423,9 @@ static SaAisErrorT clma_hdl_cbk_rec_prc( > reg_cbk->saClmClusterTrackCallback(buf, > > cbk_info->param.track.mem_num, > > cbk_info->param.track.err); > + if(buf->numberOfItems) > + free(buf->notification); > + free(buf); > } > } else { > if (reg_cbk_4->saClmClusterTrackCallback) { > @@ -448,6 +451,7 @@ static SaAisErrorT clma_hdl_cbk_rec_prc( > clma_fill_node_from_node4(node, > cbk_info->param.node_get.info); > > reg_cbk->saClmClusterNodeGetCallback(cbk_info->param.node_get.inv, > > node, cbk_info->param.node_get.err); > + free(node); > } > } else { > if (reg_cbk_4->saClmClusterNodeGetCallback) { > > -- > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from > the latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk > ___ > Opensaf-devel mailing list > Opensaf-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/opensaf-devel -- October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 1] base: change ncs_os_lock to use osaf_mutex_ utils [#605]
Ack. Thanks, Ramesh. On 10/23/2013 6:46 PM, Hans Feldt wrote: > osaf/libs/core/leap/os_defs.c | 19 ++- > 1 files changed, 6 insertions(+), 13 deletions(-) > > > Now and then a test program fails with: > os_defs.c:447: ncs_os_lock: Assertion `0' failed. > > Without core dumps enabled and a console printout this error will be invisible > and undetected with hard to predict consequences. > > By changing ncs_os_lock to use the osaf_mutex_* utility functions, the pthread > return code will be syslogged before the process is aborted (unconditionally) > > diff --git a/osaf/libs/core/leap/os_defs.c b/osaf/libs/core/leap/os_defs.c > --- a/osaf/libs/core/leap/os_defs.c > +++ b/osaf/libs/core/leap/os_defs.c > @@ -409,11 +409,10 @@ void ncs_os_atomic_destroy(void) > > / > unsigned int ncs_os_lock(NCS_OS_LOCK * lock, NCS_OS_LOCK_REQUEST request, > unsigned int type) > { > - volatile int rc; > - pthread_mutexattr_t mutex_attr; > + switch (request) { > + case NCS_OS_LOCK_CREATE: { > + pthread_mutexattr_t mutex_attr; > > - switch (request) { > - case NCS_OS_LOCK_CREATE: > if (pthread_mutexattr_init(&mutex_attr) != 0) > return (NCSCC_RC_FAILURE); > > @@ -429,24 +428,18 @@ unsigned int ncs_os_lock(NCS_OS_LOCK * l > return (NCSCC_RC_FAILURE); > > break; > - > + } > case NCS_OS_LOCK_RELEASE: > if (pthread_mutex_destroy(&lock->lock) != 0) > return (NCSCC_RC_FAILURE); > break; > > case NCS_OS_LOCK_LOCK: > - if ((rc = pthread_mutex_lock(&lock->lock)) != 0) { /* get the > lock */ > - assert(0); > - return (NCSCC_RC_FAILURE); > - } > + osaf_mutex_lock_ordie(&lock->lock); > break; > > case NCS_OS_LOCK_UNLOCK: > - if ((rc = pthread_mutex_unlock(&lock->lock)) != 0) { /* unlock > for all tasks */ > - assert(0); > - return (NCSCC_RC_FAILURE); > - } > + osaf_mutex_unlock_ordie(&lock->lock); > break; > > default: -- October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1 of 1] base: Add osaf_poll.h and osaf_time.h APIs [#580]
Hi Anders, I am not sure on the motivation behind adding more utilities to core/leap area. Also to what extent all these utility functions are used by OpenSAF services?. Because on behalf of ticket# 537, I am cleaning up the unused code from leap area and adding more utilities with out actually using them doesn't make sense. Some of the minor comments on osaf_time are inline with [Ramesh]. Coming to the osaf_poll, I have not reviewed yet. But my general comment is.. Already we have poll utility in os_defs.c (ncs_sel_obj_poll_single_obj()). Any additional poll specific utility functions (if they are subjected to use by OpenSAF svc's) can be added in os_defs.c itself. Thanks and Regards, Ramesh. On 10/8/2013 3:51 PM, Anders Widell wrote: > osaf/libs/core/common/Makefile.am |2 + > osaf/libs/core/common/include/osaf_poll.h | 97 +++ > osaf/libs/core/common/include/osaf_time.h | 371 > ++ > osaf/libs/core/common/osaf_poll.c | 130 ++ > osaf/libs/core/common/osaf_time.c | 52 > 5 files changed, 652 insertions(+), 0 deletions(-) > > > Add new utility and convenience APIs, declared in osaf_poll.h and osaf_time.h, > respectively. > > osaf_poll.h contains utility functions that work in a similar way as the Linux > function poll() and ppoll(), except that they handle errors themselves instead > of returning -1. The errno value EINTR is handled with a loop, and the > functions > keep track of time so that the time-out will happen at the same time no matter > if the functions were interrupted by a signal or not. Other errno values will > cause the process to be aborted, since they indicate the presence of a > software > bug and the program cannot continue in a safe way. > > osaf_time.h contains utility functions for reading the time and sleeping, that > work in a similar way as the Linux functions clock_gettime() and nanosleep(), > except that they abort the process instead of returning -1. There are also > utilty functions for manipulating "struct timespec" times. struct timespec is > used for representing a time in many POSIX functions, and the reason for > having > a structure is that a 64-bit integer is not sufficient for representing the > full > time. > > diff --git a/osaf/libs/core/common/Makefile.am > b/osaf/libs/core/common/Makefile.am > --- a/osaf/libs/core/common/Makefile.am > +++ b/osaf/libs/core/common/Makefile.am > @@ -32,6 +32,8 @@ libopensaf_common_la_SOURCES = \ > ncs_sprr.c \ > logtrace.c \ > osaf_utility.c \ > + osaf_poll.c \ > + osaf_time.c \ > nid_start_util.c \ > saf_edu.c \ > daemon.c \ > diff --git a/osaf/libs/core/common/include/osaf_poll.h > b/osaf/libs/core/common/include/osaf_poll.h > new file mode 100644 > --- /dev/null > +++ b/osaf/libs/core/common/include/osaf_poll.h > @@ -0,0 +1,97 @@ > +/* -*- OpenSAF -*- > + * > + * (C) Copyright 2013 The OpenSAF Foundation > + * > + * This program is distributed in the hope that it will be useful, but > + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY > + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed > + * under the GNU Lesser General Public License Version 2.1, February 1999. > + * The complete license can be accessed from the following location: > + * http://opensource.org/licenses/lgpl-license.php > + * See the Copying file included with the OpenSAF distribution for full > + * licensing terms. > + * > + * Author(s): Ericsson AB > + * > + */ > + > +/** @file > + * > + * This file contains an OpenSAF replacement of the POSIX function poll(). > The > + * definitions in this file are for internal use within OpenSAF only. > + */ > + > +#ifndef OPENSAF_BASE_OSAF_POLL_H_ > +#define OPENSAF_BASE_OSAF_POLL_H_ > + > +#include > +#include > +#include > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +/** > + * @brief Wait for events on file descriptors > + * > + * This is a convenience function that behaves exactly like the POSIX > function > + * poll(3P), except that it will abort the process instead of returning an > error > + * code in case of a failure. It handles the EINTR case internally with a > loop, > + * and ensures that the function will time out at the same time no matter if > the > + * system call was interrupted by a signal or not. > + * > + * The return value will always be in the range [0, i_nfds]. > + */ > +extern unsigned osaf_poll(struct pollfd* io_fds, nfds_t i_nfds, int > i_timeout); > + > +/** > + * @brief Wait for events on file descriptors > + * > + * This is a convenience function that behaves exactly like the Linux > function > + * ppoll(3), except that it will abort the process instead of returning an > error > + * code in case of a failure. It handles the EINTR case internally with a > loop, > + * and ensures that the function will time out at the same time no matter if > the > + * system call
Re: [devel] [PATCH 1 of 1] base: Add osaf_poll.h and osaf_time.h APIs [#580]
Hi Anders, >> [Ramesh]: Above function should take care of comparing i_end and i_start tmr values and should take appropriate action. > [AndersW]: Do you mean that the function... For the above comment I'll make a direct statement., what if user gives "i_end" timer values lesser-than "i_start" timer values. Thanks, Ramesh. On 10/30/2013 3:22 PM, Anders Widell wrote: > Hi! > > Thanks for the comments. Se my replies inline below. > > regards, > Anders Widell > > 2013-10-30 10:00, Ramesh Betham skrev: >> Hi Anders, >> >> I am not sure on the motivation behind adding more utilities to >> core/leap area. >> >> Also to what extent all these utility functions are used by OpenSAF >> services?. Because on behalf of ticket# 537, I am cleaning up the >> unused code from leap area and adding more utilities with out >> actually using them doesn't make sense. > They are not used yet, but they will be used by the patch for ticket > [#452]. I am posting the new APIs as a separate ticket since they are > generic and can be used even if ticket [#452] is not implemented. Will > post the patches for ticket [#452] later today. >> >> Some of the minor comments on osaf_time are inline with [Ramesh]. >> >> Coming to the osaf_poll, I have not reviewed yet. But my general >> comment is.. Already we have poll utility in os_defs.c >> (ncs_sel_obj_poll_single_obj()). Any additional poll specific utility >> functions (if they are subjected to use by OpenSAF svc's) can be >> added in os_defs.c itself. > I could put everything in os_defs.c and os_defs.h, but I kind of agree > with the comment at the top of os_defs.h: > > /* > > DESCRIPTION: > > This module contains old legacy interfaces > TODO: clean up and eventually (re)moved > > ** > */ > > The idea behind osaf_poll.h and osaf_time.h is that they are closely > related to the POSIX header files and . So utility > functions that enhance POSIX functions found in poll.h are put in the > header file osaf_poll.h. Also, I have tried to used APIs that are > either identical to, or very similar to, the POSIX APIs. This means > that it is very easy to understand how the functions work if you are > already faimilar with the corresponding POSIX functions. The API > documentation only describes the differences between the POSIX > function and the OpenSAF utility function. > > I also like the idea of separating the code into smaller units with a > specific purpose (e.g. osaf_time.h for time-related functions) rather > than putting everything into one big file. In an earlier ticket I > introduced the file osaf_utility.h as a file for utility functions, > but now I consider this to be a mistake. Everything should not go into > one single file, but rather the pthreads APIs should be separated out > into something called e.g. osaf_thread.h. >> >> Thanks and Regards, >> Ramesh. >> >> On 10/8/2013 3:51 PM, Anders Widell wrote: >>> osaf/libs/core/common/Makefile.am |2 + >>> osaf/libs/core/common/include/osaf_poll.h | 97 +++ >>> osaf/libs/core/common/include/osaf_time.h | 371 >>> ++ >>> osaf/libs/core/common/osaf_poll.c | 130 ++ >>> osaf/libs/core/common/osaf_time.c | 52 >>> 5 files changed, 652 insertions(+), 0 deletions(-) >>> >>> >>> Add new utility and convenience APIs, declared in osaf_poll.h and >>> osaf_time.h, >>> respectively. >>> >>> osaf_poll.h contains utility functions that work in a similar way as the >>> Linux >>> function poll() and ppoll(), except that they handle errors themselves >>> instead >>> of returning -1. The errno value EINTR is handled with a loop, and the >>> functions >>> keep track of time so that the time-out will happen at the same time no >>> matter >>> if the functions were interrupted by a signal or not. Other errno values >>> will >>> cause the process to be aborted, since they indicate the presence of a >>> software >>> bug and the program cannot continue in a safe way. >>> >>> osaf_time.h contains utility functions for reading the time and sleeping, >>> that >>> work in a similar way as the Linux functions clock_gettime() and >>> nanosleep(), >>> except that they abort the process inst
Re: [devel] [PATCH 00 of 15] Review Request for osaf: Replace select() with osaf_poll() to avoid 1024 fd limit [#452]
Hi Anders, Here are my review comments. Not tested. 1. In osaf_ppoll(), until ppoll() is in real use.. can we keep the logics simple to poll() for now don't use osaf_ppoll() and let the osaf_poll() take care calling poll() etc. 2. In osaf_ppoll(), for result = poll(), need to handle the case where revents set to POLLNVAL. 3. Where ever pollfd struct is set/initialized with fd and POLLIN, also please set revents=0;. 4. In nbconnect() of contrib/plmc/plmcd/plmcd.c: wset.events = POLLOUT; should be wset.events = POLLIN; This patch enforces to test OpenSAF thoroughly to handle all possible cases of poll() usage. Thanks, Ramesh. On 10/31/2013 6:54 PM, Anders Widell wrote: > Summary: osaf: Replace select() with osaf_poll() to avoid 1024 fd limit [#452] > Review request for Trac Ticket(s): 452 > Peer Reviewer(s): Mathi, Ramesh > Pull request to: > Affected branch(es): default(4.4) > Development branch: default > > > Impacted area Impact y/n > > Docsn > Build systemn > RPM/packaging n > Configuration files n > Startup scripts n > SAF servicesy > OpenSAF servicesy > Core libraries y > Samples n > Tests y > Other n > > > Comments (indicate scope for each "y" above): > - > This set of patches replace usages of select() with the new osaf_poll() API > introduced in ticket [#580]. Stricly speaking, not all of them have to be > replaced in order to solve the problem described in ticket [#452], but to > ensure that no select() that should have been replaced is forgotten, we > replace all occurrences of select(). This way, it is easy to check that > select() is not used, e.g. by running the grep command on the source tree. > > Note that the java bindings have not yet been fixed. They will be fixed in > a patch that will be sent out later. > > changeset 8bd7a81783f17268607be9ad703bc7978e1df7ff > Author: Anders Widell > Date: Thu, 31 Oct 2013 14:13:50 +0100 > > amf: Replace select() with osaf_poll() to avoid 1024 fd limit [#452] > > The select() function cannot handle file descriptors larger than 1023. > To > avoid this limitation, we replace all usages of select() with poll(). > > changeset 7a3af5d1b0464b7cb2b2c1b749f6e0a8530f8f34 > Author: Anders Widell > Date: Thu, 31 Oct 2013 14:13:50 +0100 > > base: Replace select() with osaf_poll() to avoid 1024 fd limit [#452] > > The select() function cannot handle file descriptors larger than 1023. > To > avoid this limitation, we replace all usages of select() with poll(). > > The following APIs were based on select() and have been removed from > BASE: > > m_SET_FD_IN_SEL_OBJ() m_GET_HIGHER_SEL_OBJ() ncs_sel_obj_select() > m_NCS_SEL_OBJ_SELECT() ncs_sel_obj_poll_single_obj() > m_NCS_SEL_OBJ_POLL_SINGLE_OBJ() m_NCS_SEL_OBJ_ZERO() m_NCS_SEL_OBJ_SET() > m_NCS_SEL_OBJ_ISSET() m_NCS_SEL_OBJ_CLR() NCS_SEL_OBJ_SET > > changeset 7738c5ed214580b07dabf9519e87b3e78b8f9745 > Author: Anders Widell > Date: Thu, 31 Oct 2013 14:13:50 +0100 > > ckpt: Replace select() with osaf_poll() to avoid 1024 fd limit [#452] > > The select() function cannot handle file descriptors larger than 1023. > To > avoid this limitation, we replace all usages of select() with poll(). > > changeset 68977bc498106e797d31c530e944641741911ac8 > Author: Anders Widell > Date: Thu, 31 Oct 2013 14:13:50 +0100 > > clm: Replace select() with osaf_poll() to avoid 1024 fd limit [#452] > > The select() function cannot handle file descriptors larger than 1023. > To > avoid this limitation, we replace all usages of select() with poll(). > > changeset 6fdf5ea8d207c1ca7e26952fa4432504c305a244 > Author: Anders Widell > Date: Thu, 31 Oct 2013 14:13:50 +0100 > > dtm: Replace select() with osaf_poll() to avoid 1024 fd limit [#452] > > The select() function cannot handle file descriptors larger than 1023. > To > avoid this limitation, we replace all usages of select() with poll(). > > changeset fecc4ff2bab5c0fc232dd93b1d80c15014423719 > Author: Anders Widell > Date: Thu, 31 Oct 2013 14:13:50 +0100 > > evt: Replace select() with osaf_poll() to avoid 1024 fd limit [#452] > > The select() function cannot handle file descriptors larger than 1023. > To > avoid this limitation, we replace all usages of select() with poll(). > > changeset 74935cb76deeba539d1dc4b0f9136014b1f5bf94 > Author: Anders Widell > Date: Thu, 31 Oct 2013 14:13:50 +0100 > > imm: Replace select() with osaf_poll() to avoid 1024 fd limit [#452] > > The select() function cannot handle file descriptors larger than 1023. > To > avoid this limitation, we replace all usages of
Re: [devel] [PATCH 1 of 1] clm: treat ERR_EXIST as TRY_AGAIN and support a flag for pending RTupdates [#528]
Hi Mathi, Please find my review comments inline[Ramesh]. Thanks, Ramesh. On 11/15/2013 12:58 PM, mathi.naic...@oracle.com wrote: > osaf/services/saf/clmsv/clms/clms_amf.c |9 +- > osaf/services/saf/clmsv/clms/clms_cb.h |4 + > osaf/services/saf/clmsv/clms/clms_imm.c | 243 > +++--- > osaf/services/saf/clmsv/clms/clms_imm.h |3 + > osaf/services/saf/clmsv/clms/clms_main.c | 25 ++- > 5 files changed, 252 insertions(+), 32 deletions(-) > > > ERR_EXIST and TRY_AGAIN are treated the same. Also, a rtu_pending flag is > introduced. > The flag is toggled when an IMM API throws a TRY_AGAIN or ERR_EXIST and when > the > call is reattempted later and if the call succeeds the flag is turned off. > > diff --git a/osaf/services/saf/clmsv/clms/clms_amf.c > b/osaf/services/saf/clmsv/clms/clms_amf.c > --- a/osaf/services/saf/clmsv/clms/clms_amf.c > +++ b/osaf/services/saf/clmsv/clms/clms_amf.c > @@ -256,8 +256,11 @@ static void clms_amf_csi_set_callback(Sa > > if (role_change == true) { > > - if(clms_cb->ha_state == SA_AMF_HA_ACTIVE) > + if(clms_cb->ha_state == SA_AMF_HA_ACTIVE) { > clms_imm_impl_set(clms_cb); > + /* Unconditionally refresh IMM for runtime attributes > + clms_switchon_all_pending_rtupdates(); */ > + } > > if ((rc = clms_mds_change_role(clms_cb)) != NCSCC_RC_SUCCESS) { > LOG_ER("clms_mds_change_role FAILED"); > @@ -266,6 +269,10 @@ static void clms_amf_csi_set_callback(Sa > /* Inform MBCSV of HA state change */ > if (NCSCC_RC_SUCCESS != (error = > clms_mbcsv_change_HA_state(clms_cb))) > error = SA_AIS_ERR_FAILED_OPERATION; > + > + /* Clear up any rtu updates, the active will take care of it */ > + if (clms_cb->ha_state == SA_AMF_HA_STANDBY) > + clms_switchoff_all_pending_rtupdates(); > } > [Ramesh]: To be consistent with role changes, better to do clms_switchon_all_pending_rtupdates(); when role change to ACTIVE else clms_switchoff_all_pending_rtupdates(); >response: > diff --git a/osaf/services/saf/clmsv/clms/clms_cb.h > b/osaf/services/saf/clmsv/clms/clms_cb.h > --- a/osaf/services/saf/clmsv/clms/clms_cb.h > +++ b/osaf/services/saf/clmsv/clms/clms_cb.h > @@ -40,6 +40,7 @@ typedef struct cluster_db_t { > SaNameT name; > SaUint32T num_nodes; > SaTimeT init_time; > +SaBoolT rtu_pending; > /*struct cluster_db_t *next; */ /* Multiple cluster is not supported as > of now */ > } CLMS_CLUSTER_INFO; > > @@ -69,6 +70,8 @@ typedef struct cluster_node_t { > ADMIN_OP admin_op; /*plm or clm operation */ > timer_t lock_timerid; /*Timer id for admin lock operation */ > SaInvocationT plm_invid;/*plmtrack callback invocation id */ > + SaBoolT rtu_pending; /* Flag to mark whether an IMM RunTime attribute > Update is pending and to be retried */ > + SaBoolT admin_rtu_pending; /* Flag to mark whether an IMM RunTime > attribute Update is pending and to be retried */ > struct cluster_node_t *dep_node_list; /*Dependent nodes list - in > case of plm operation */ > struct cluster_node_t *next; > } CLMS_CLUSTER_NODE; > @@ -172,6 +175,7 @@ typedef struct clms_cb_t { > SaSelectionObjectT plm_sel_obj; /* PLMSv selection object */ > SaNtfHandleT ntf_hdl; /* Handled obtained from NTFSv */ > SaBoolT reg_with_plm; /*plm present in system */ > +SaBoolT rtu_pending; /* Global flag to determine a pending RTU > update and the poll timeout */ > CLMA_DOWN_LIST *clma_down_list_head;/* CLMA down reccords - Fix for > Failover missed > down events Processing */ > CLMA_DOWN_LIST *clma_down_list_tail; > diff --git a/osaf/services/saf/clmsv/clms/clms_imm.c > b/osaf/services/saf/clmsv/clms/clms_imm.c > --- a/osaf/services/saf/clmsv/clms/clms_imm.c > +++ b/osaf/services/saf/clmsv/clms/clms_imm.c > @@ -22,6 +22,9 @@ > extern struct ImmutilWrapperProfile immutilWrapperProfile; > > void clms_all_node_rattr_update(void); > +void clms_retry_pending_rtupdates(void); > +void clms_switchoff_all_pending_rtupdates(void); > +void clms_switchon_all_pending_rtupdates(void); > SaAisErrorT clms_node_ccb_comp_cb(CcbUtilOperationData_t * opdata); > uint32_t clms_imm_node_unlock(CLMS_CLUSTER_NODE * nodeop); > uint32_t clms_imm_node_lock(CLMS_CLUSTER_NODE * nodeop); > @@ -32,6 +35,10 @@ static uint32_t clms_lock_send_no_start_ > > static SaVersionT immVersion = { 'A', 2, 1 }; > > + > +const unsigned int sleep_delay_ms = 500; > +const unsigned int max_waiting_time_ms = 60 * 1000; /* 60 seconds */ > + > /** > * Initialize the track response patricia tree for the node > * @param[in] node node to initialize trackresponse tree > @@ -64,22 +
[devel] make rpm is failing: ticket# 580
Hi Anders, make rpm fails, please check. (osaf_poll.h, osaf_time.h should add in ../osaf/libs/core/common/includeMakefile.am) Thanks, Ramesh. libopensaf_common_la-osaf_poll.lo -MD -MP -MF .deps/libopensaf_common_la-osaf_poll.Tpo -c osaf_poll.c -fPIC -DPIC -o .libs/libopensaf_common_la-osaf_poll.o osaf_poll.c:18:23: error: osaf_poll.h: No such file or directory osaf_poll.c:21:23: error: osaf_time.h: No such file or directory osaf_poll.c:25: error: expected declaration specifiers or â...â before ânfds_tâ cc1: warnings being treated as errors osaf_poll.c:25: error: âstruct pollfdâ declared inside parameter list osaf_poll.c:25: error: its scope is only this definition or declaration, which is probably not what you want osaf_poll.c:27: error: expected declaration specifiers or â...â before ânfds_tâ osaf_poll.c:27: error: âstruct pollfdâ declared inside parameter list osaf_poll.c:27: error: conflicting types for âosaf_poll_no_timeoutâ osaf_poll.c:25: error: previous declaration of âosaf_poll_no_timeoutâ was here osaf_poll.c: In function âosaf_poll_no_timeoutâ: osaf_poll.c:31: error: implicit declaration of function âpollâ osaf_poll.c:31: error: âi_nfdsâ undeclared (first use in this function) osaf_poll.c:31: error: (Each undeclared identifier is reported only once osaf_poll.c:31: error: for each function it appears in.) osaf_poll.c: At top level: osaf_poll.c:38: error: expected declaration specifiers or â...â before ânfds_tâ osaf_poll.c:38: error: âstruct pollfdâ declared inside parameter list osaf_poll.c: In function âosaf_pollâ: osaf_poll.c:41: error: âi_nfdsâ undeclared (first use in this function) osaf_poll.c:41: error: passing argument 1 of âosaf_poll_no_timeoutâ from incompatible pointer type osaf_poll.c:41: error: too many arguments to function âosaf_poll_no_timeoutâ osaf_poll.c:42: error: implicit declaration of function âosaf_millis_to_timespecâ osaf_poll.c:43: error: implicit declaration of function âosaf_ppollâ osaf_poll.c: At top level: osaf_poll.c:46: error: expected declaration specifiers or â...â before ânfds_tâ osaf_poll.c:47: error: âstruct pollfdâ declared inside parameter list osaf_poll.c:46: error: conflicting types for âosaf_ppollâ osaf_poll.c:43: error: previous implicit declaration of âosaf_ppollâ was here osaf_poll.c: In function âosaf_ppollâ: osaf_poll.c:59: error: âkNanosPerSecâ undeclared (first use in this function) osaf_poll.c:59: error: âkMillisPerSecâ undeclared (first use in this function) osaf_poll.c:78: error: âi_nfdsâ undeclared (first use in this function) osaf_poll.c:78: error: passing argument 1 of âosaf_poll_no_timeoutâ from incompatible pointer type osaf_poll.c:78: error: too many arguments to function âosaf_poll_no_timeoutâ osaf_poll.c:80: error: implicit declaration of function âosaf_clock_gettimeâ osaf_poll.c:91: error: implicit declaration of function âosaf_timespec_addâ osaf_poll.c:94: error: implicit declaration of function âosaf_timespec_compareâ osaf_poll.c:96: error: implicit declaration of function âosaf_timespec_to_millisâ osaf_poll.c:110: error: implicit declaration of function âosaf_timespec_subtractâ osaf_poll.c: In function âosaf_poll_one_fdâ: osaf_poll.c:132: error: storage size of âsetâ isnât known osaf_poll.c:135: error: âPOLLINâ undeclared (first use in this function) osaf_poll.c:136: error: too many arguments to function âosaf_pollâ osaf_poll.c:138: error: âPOLLNVALâ undeclared (first use in this function) osaf_poll.c:138: error: âPOLLERRâ undeclared (first use in this function) osaf_poll.c:138: error: âPOLLHUPâ undeclared (first use in this function) osaf_poll.c:132: error: unused variable âsetâ make[7]: *** [libopensaf_common_la-osaf_poll.lo] Error 1 make[7]: Leaving directory `/ramesh/opensaf-staging-new/rpms/BUILD/opensaf-4.4.M0/osaf/libs/core/common' make[6]: *** [all-recursive] Error 1 make[6]: Leaving directory `/ramesh/opensaf-staging-new/rpms/BUILD/opensaf-4.4.M0/osaf/libs/core/common' make[5]: *** [all-recursive] Error 1 make[5]: Leaving directory `/ramesh/opensaf-staging-new/rpms/BUILD/opensaf-4.4.M0/osaf/libs/core' make[4]: *** [all-recursive] Error 1 make[4]: Leaving directory `/ramesh/opensaf-staging-new/rpms/BUILD/opensaf-4.4.M0/osaf/libs' make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory `/ramesh/opensaf-staging-new/rpms/BUILD/opensaf-4.4.M0/osaf' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/ramesh/opensaf-staging-new/rpms/BUILD/opensaf-4.4.M0' make[1]: *** [all] Error 2 make[1]: Leaving directory `/ramesh/opensaf-staging-new/rpms/BUILD/opensaf-4.4.M0' error: Bad exit status from /ramesh/opensaf-staging-new/rpms/tmp/rpm-tmp.1908 (%build) RPM build errors: Bad exit status from /ramesh/opensaf-staging-new/rpms/tmp/rpm-tmp.1908 (%build) make: *** [rpm] Error 1 -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how applicatio
[devel] [PATCH 13 of 16] base: Removed unused macros from ncs_tmr.h [#537]
osaf/libs/core/include/ncs_tmr.h | 3 --- osaf/libs/core/leap/hj_tmr.c | 11 +-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/osaf/libs/core/include/ncs_tmr.h b/osaf/libs/core/include/ncs_tmr.h --- a/osaf/libs/core/include/ncs_tmr.h +++ b/osaf/libs/core/include/ncs_tmr.h @@ -76,9 +76,6 @@ extern "C" { uint32_t svc_sub_id; } NCS_RP_TMR_INIT; -#define m_IS_TIME_STAMP_SAME(dest_tmr, src_tmr) memcmp (&dest_tmr, &src_tmr, sizeof(time_t)) -#define m_RP_TMR_ALLOC(size, svc_id, sub_svc_id) m_NCS_MEM_ALLOC(size, NCS_MEM_REGION_PERSISTENT, svc_id, sub_svc_id) -#define m_RP_TMR_FREE(ptr, svc_id, sub_svc_id) m_NCS_MEM_FREE(ptr, NCS_MEM_REGION_PERSISTENT, svc_id, sub_svc_id) #undef RP_LOG_ENB #ifdef RP_LOG_ENB diff --git a/osaf/libs/core/leap/hj_tmr.c b/osaf/libs/core/leap/hj_tmr.c --- a/osaf/libs/core/leap/hj_tmr.c +++ b/osaf/libs/core/leap/hj_tmr.c @@ -105,8 +105,7 @@ NCS_RP_TMR_CB *ncs_rp_tmr_init(NCS_RP_TM { NCS_RP_TMR_CB *tmr_cb; - tmr_cb = (NCS_RP_TMR_CB *)m_RP_TMR_ALLOC(sizeof(NCS_RP_TMR_CB), tmr_init_info->svc_id, -tmr_init_info->svc_sub_id); + tmr_cb = (NCS_RP_TMR_CB *)malloc(sizeof(NCS_RP_TMR_CB)); if (tmr_cb == NULL) { m_RP_TMR_LOG_MSG("ncs_rp_tmr_init Os alloc failed", 0); @@ -145,7 +144,7 @@ NCS_RP_TMR_HDL ncs_rp_tmr_create(NCS_RP_ NCS_RP_TMR_INFO *tmr_info; /* allocate an leaf node and add it to the bucket */ - tmr_info = (NCS_RP_TMR_INFO *)m_RP_TMR_ALLOC(sizeof(NCS_RP_TMR_INFO), tmr_cb->svc_id, tmr_cb->svc_sub_id); + tmr_info = (NCS_RP_TMR_INFO *)malloc(sizeof(NCS_RP_TMR_INFO)); if (tmr_info == NULL) { m_RP_TMR_LOG_MSG("ncs_rp_tmr_start NCS_RP_TMR_INFO OS alloc failed", 0); @@ -403,7 +402,7 @@ uint32_t ncs_rp_tmr_delete(NCS_RP_TMR_CB m_RP_TMR_LOG_MSG("ncs_rp_tmr_delete timer timer is not stoped", tmr_info); ncs_rp_tmr_stop(tmr_cb, tmr_id); } - m_RP_TMR_FREE(tmr_info, tmr_cb->svc_id, tmr_cb->svc_sub_id); + free(tmr_info); } while (0); m_NCS_UNLOCK(&tmr_cb->tmr_lock, NCS_LOCK_WRITE); return (res); @@ -440,7 +439,7 @@ uint32_t ncs_rp_tmr_destory(NCS_RP_TMR_C pres_tmr_info = tmr_info; for (; tmr_info != NULL;) { tmr_info = tmr_info->pnext; - m_RP_TMR_FREE(pres_tmr_info, tmr_cb->svc_id, tmr_cb->svc_sub_id); + free(pres_tmr_info); pres_tmr_info = tmr_info; } @@ -449,7 +448,7 @@ uint32_t ncs_rp_tmr_destory(NCS_RP_TMR_C /* destroy the lock */ m_NCS_LOCK_DESTROY(&tmr_cb->tmr_lock); /* free the RP control block */ - m_RP_TMR_FREE(tmr_cb, tmr_cb->svc_id, tmr_cb->svc_sub_id); + free(tmr_cb); *pptmr_cb = NULL; return (NCSCC_RC_SUCCESS); } -- Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 16 of 16] base: Removed unsed functions from ncs_main_pub.h [#537]
osaf/libs/core/common/include/ncs_main_pub.h |1 - osaf/libs/core/common/ncs_main_pub.c | 123 -- osaf/libs/core/include/ncs_main_papi.h | 67 + 3 files changed, 1 insertions(+), 190 deletions(-) diff --git a/osaf/libs/core/common/include/ncs_main_pub.h b/osaf/libs/core/common/include/ncs_main_pub.h --- a/osaf/libs/core/common/include/ncs_main_pub.h +++ b/osaf/libs/core/common/include/ncs_main_pub.h @@ -40,7 +40,6 @@ Utility APIs defined in ncs_main_pub.c \***/ -char ncs_util_get_char_option(int argc, char *argv[], char *arg_prefix); char *ncs_util_search_argv_list(int argc, char *argv[], char *arg_prefix); uint32_t file_get_word(FILE **fp, char *o_chword); uint32_t file_get_string(FILE **fp, char *o_chword); diff --git a/osaf/libs/core/common/ncs_main_pub.c b/osaf/libs/core/common/ncs_main_pub.c --- a/osaf/libs/core/common/ncs_main_pub.c +++ b/osaf/libs/core/common/ncs_main_pub.c @@ -656,80 +656,6 @@ uint32_t mainget_node_id(uint32_t *node_ return (res); } -/* Fetchs the chassis type string */ -uint32_t ncs_get_chassis_type(uint32_t i_max_len, char *o_chassis_type) -{ - FILE *fp; - uint32_t res = NCSCC_RC_SUCCESS; - uint32_t d_len, f_len; - uint32_t file_size = 0; - char temp_ncs_config_root[MAX_NCS_CONFIG_FILEPATH_LEN + 1]; - - if ((res = ncs_set_config_root()) != NCSCC_RC_SUCCESS) - return NCSCC_RC_FAILURE; - - memset(temp_ncs_config_root, 0, sizeof(temp_ncs_config_root)); - - strncpy(temp_ncs_config_root, ncs_config_root, sizeof(temp_ncs_config_root) - 1); - - if (i_max_len > NCS_MAX_CHASSIS_TYPE_LEN) - return NCSCC_RC_FAILURE; - - d_len = strlen(temp_ncs_config_root); - - f_len = strlen("/chassis_type"); - if ((d_len + f_len) >= MAX_NCS_CONFIG_FILEPATH_LEN) { - TRACE_4("\n Filename too long \n"); - return NCSCC_RC_FAILURE; - } - - /* Hack ncs_config_root to construct path */ - sprintf(temp_ncs_config_root + d_len, "%s", "/chassis_type"); - fp = fopen(temp_ncs_config_root, "r"); - if (fp == NULL) { - TRACE_4("\nNCS: Couldn't open %s/chassis_type \n", temp_ncs_config_root); - return NCSCC_RC_FAILURE; - } - - /* positions the file pointer to the end of the file */ - if (0 != fseek(fp, 0L, SEEK_END)) { - TRACE_4("fseek call failed with errno %d \n", errno); - fclose(fp); - return NCSCC_RC_FAILURE; - } - - /* gets the file pointer offset from the start of the file */ - file_size = ftell(fp); - if (file_size == -1) { - TRACE_4("ftell call failed with errno %d \n", errno); - fclose(fp); - return NCSCC_RC_FAILURE; - } - - /* validating the file size */ - if ((file_size > NCS_MAX_CHASSIS_TYPE_LEN + 1) || (file_size > i_max_len + 1) || (file_size == 0)) { - TRACE_4("Some thing wrong with chassis_type file \n"); - fclose(fp); - return NCSCC_RC_FAILURE; - } - - /* positions the file pointer to the end of the file */ - if (0 != fseek(fp, 0L, SEEK_SET)) { - TRACE_4("fseek call failed with errno %d \n", errno); - fclose(fp); - return NCSCC_RC_FAILURE; - } - - do { - /* reads the chassis type string from the file and copies into the user provided buffer */ - file_get_string(&fp, o_chassis_type); - - fclose(fp); - - } while (0); - - return (res); -} static uint32_t ncs_set_config_root(void) { @@ -860,28 +786,6 @@ uint32_t ncs_update_sys_param_args(void) return NCSCC_RC_SUCCESS; } -/***\ - - PROCEDURE:ncs_util_get_char_option - -\***/ -char ncs_util_get_char_option(int argc, char *argv[], char *arg_prefix) -{ - char char_option; - char *p_field; - - p_field = ncs_util_search_argv_list(argc, argv, arg_prefix); - if (p_field == NULL) { - return 0; - } - if (sscanf(p_field + strlen(arg_prefix), "%c", &char_option) != 1) { - return 0; - } - if (isupper(char_option)) - char_option = (char)tolower(char_option); - - return char_option; -} /***\ @@ -901,33 +805,6 @@ char *ncs_util_search_argv_list(int argc return NULL; } -/ - Name : ncs_get_node_id_from_phyinfo - - Description : This function combines chassis id ,physical -
[devel] [PATCH 08 of 16] base: Deleted sysf_def.h file [#537]
osaf/libs/common/mqsv/include/mqsv.h|1 - osaf/libs/core/leap/hj_edp.c| 53 +++--- osaf/libs/core/leap/hj_edu.c| 29 +- osaf/libs/core/leap/include/Makefile.am |1 - osaf/libs/core/leap/include/sysf_def.h | 274 -- osaf/libs/core/leap/sysf_def.c |1 - osaf/libs/core/leap/sysf_mem.c |1 - osaf/libs/core/leap/sysf_tmr.c |1 - 8 files changed, 40 insertions(+), 321 deletions(-) diff --git a/osaf/libs/common/mqsv/include/mqsv.h b/osaf/libs/common/mqsv/include/mqsv.h --- a/osaf/libs/common/mqsv/include/mqsv.h +++ b/osaf/libs/common/mqsv/include/mqsv.h @@ -72,7 +72,6 @@ #include "stdlib.h" /* From /leap/os_svcs/leap_basic/inc */ -#include "sysf_def.h" #include "mqsv_common.h" #include "ncs_util.h" diff --git a/osaf/libs/core/leap/hj_edp.c b/osaf/libs/core/leap/hj_edp.c --- a/osaf/libs/core/leap/hj_edp.c +++ b/osaf/libs/core/leap/hj_edp.c @@ -32,7 +32,6 @@ #include "ncssysf_mem.h" #include "ncsencdec_pub.h" #include "ncs_edu.h" -#include "sysf_def.h" #include "ncs_ubaid.h" extern char gl_log_string[]; @@ -80,7 +79,7 @@ uint32_t ncs_edp_ncs_bool(EDU_HDL *hdl, if (*(bool **)ptr == NULL) { /* Since "ncs_edp_ncs_bool" is the responsibility of LEAP, LEAP is supposed to malloc this memory. */ - (*(bool **)ptr) = uptr = m_MMGR_ALLOC_EDP_bool; + (*(bool **)ptr) = uptr = (bool *)malloc(sizeof(bool)); if (uptr == NULL) { /* Memory failure. */ *o_err = EDU_ERR_MEM_FAIL; @@ -114,7 +113,7 @@ uint32_t ncs_edp_ncs_bool(EDU_HDL *hdl, /* We need populate the pointer here, so that it can be sent back to the parent invoker(most likely to be able to perform the TEST condition). */ - uptr = m_MMGR_ALLOC_EDP_bool; + uptr = (bool*)malloc(sizeof(bool)); if (uptr == NULL) { /* Memory failure. */ *o_err = EDU_ERR_MEM_FAIL; @@ -222,7 +221,7 @@ uint32_t ncs_edp_uns8(EDU_HDL *hdl, EDU_ if (*(uint8_t **)ptr == NULL) { /* Since "ncs_edp_uns8" is the responsibility of LEAP, LEAP is supposed to malloc this memory. */ - (*(uint8_t **)ptr) = uptr = m_MMGR_ALLOC_EDP_UNS8(len); + (*(uint8_t **)ptr) = uptr = malloc((len)*sizeof(uint8_t)); if (uptr == NULL) { /* Memory failure. */ *o_err = EDU_ERR_MEM_FAIL; @@ -278,7 +277,7 @@ uint32_t ncs_edp_uns8(EDU_HDL *hdl, EDU_ len |= (uint16_t)*(p8)++; } - uptr = m_MMGR_ALLOC_EDP_UNS8(len); + uptr = malloc((len)*sizeof(uint8_t)); if (uptr == NULL) { /* Memory failure. */ *o_err = EDU_ERR_MEM_FAIL; @@ -395,7 +394,7 @@ uint32_t ncs_edp_uns16(EDU_HDL *hdl, EDU if (*(uint16_t **)ptr == NULL) { /* Since "ncs_edp_uns16" is the responsibility of LEAP, LEAP is supposed to malloc this memory. */ - (*(uint16_t **)ptr) = uptr = m_MMGR_ALLOC_EDP_UNS8(sizeof(uint16_t) * len); + (*(uint16_t **)ptr) = uptr = malloc((sizeof(uint16_t) * len)*sizeof(uint8_t)); if (uptr == NULL) { /* Memory failure. */ *o_err = EDU_ERR_MEM_FAIL; @@ -444,7 +443,7 @@ uint32_t ncs_edp_uns16(EDU_HDL *hdl, EDU len |= (uint16_t)*(p8)++; } - uptr = m_MMGR_ALLOC_EDP_UNS8(sizeof(uint16_t) * len); + uptr = malloc((sizeof(uint16_t) * len)*sizeof(uint8_t)); if (uptr == NULL) { /* Memory failure. */ *o_err = EDU_ERR_MEM_FAIL; @@ -550,7 +549,7 @@ uint32_t ncs_edp_uns32(EDU_HDL *hdl, EDU if (*(uint32_t **)ptr == NULL) { /* Since "ncs_edp_uns32" is the responsibility of LEAP, LEAP is supposed to malloc this memory. */ - (*(uint32_t **)ptr) = uptr = m_MMGR_ALLOC_EDP_UNS8(4 * len); +
[devel] [PATCH 04 of 16] base: Removed unsed macro's from ncs_edu.h[#537]
osaf/libs/core/leap/include/ncs_edu.h | 9 - 1 files changed, 0 insertions(+), 9 deletions(-) diff --git a/osaf/libs/core/leap/include/ncs_edu.h b/osaf/libs/core/leap/include/ncs_edu.h --- a/osaf/libs/core/leap/include/ncs_edu.h +++ b/osaf/libs/core/leap/include/ncs_edu.h @@ -42,15 +42,6 @@ #include "ncs_edu_pub.h" -#define m_NCS_EDU_ASSERTassert(0) - -/* EDU Protocol Marker used in EDU header */ -#define EDU_PROT_MARKER 0xed - -/* Bitmap for EDU-options in the EDU-header */ -#define EDU_UBUF_USE_DIFF_EDP 0x01 -#define EDU_ALLOW_PARTIAL_DECODE0x02 /* Allows one-time partial - decode of USRBUF */ /* TLV Header size(for Type and Length) */ #define EDU_TLV_HDR_SIZE3 -- Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel