Hi Nagu,

 

Thanks for your comment.

If m_NCS_IPC_SEND fails, smfa_cbk_ok_resp_process() is called to free memory.

 

Best Regards,

Thuan

 

From: nagen...@hasolutions.in <nagen...@hasolutions.in> 
Sent: Friday, July 13, 2018 9:29 PM
To: thuan.tran <thuan.t...@dektech.com.au>; nguyen.tk....@dektech.com.au; 
lennart.l...@ericsson.com; gary....@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [PATCH 1/1] smf: Increase cbk count before post the evt to client 
[#2882]

 

Hi Thuan,

                    Nice work. Ack from me.

It would be nice if the memory allocated above in the function need to be 
deallocated if m_NCS_IPC_SEND fails.

 

Thanks,

Nagendra, 91-9866424860

www.hasolutions.in <http://www.hasolutions.in> 

https://www.linkedin.com/company/hasolutions/

High Availability Solutions Pvt. Ltd.

- OpenSAF support and services

 

 

 

 

 

 

 

--------- Original Message --------- 

Subject: [PATCH 1/1] smf: Increase cbk count before post the evt to client 
[#2882]
From: "thuan.tran" <thuan.t...@dektech.com.au 
<mailto:thuan.t...@dektech.com.au> >
Date: 7/13/18 9:22 am
To: nagen...@hasolutions.in <mailto:nagen...@hasolutions.in> , 
nguyen.tk....@dektech.com.au <mailto:nguyen.tk....@dektech.com.au> , 
lennart.l...@ericsson.com <mailto:lennart.l...@ericsson.com> , 
gary....@dektech.com.au <mailto:gary....@dektech.com.au> 
Cc: opensaf-devel@lists.sourceforge.net 
<mailto:opensaf-devel@lists.sourceforge.net> , "thuan.tran" 
<thuan.t...@dektech.com.au>

Sometimes, callback agent dispatch and fail at saSmfReponse()
because cbk list is empty, agent by somehow handle evt before increase
cbk count. To avoid this, increase cbk count before post the evt.
---
src/smf/agent/smfa_utils.c | 40 +++++++++++++++++++++-----------------
1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/src/smf/agent/smfa_utils.c b/src/smf/agent/smfa_utils.c
index fb31a9ae1..3436785cd 100644
--- a/src/smf/agent/smfa_utils.c
+++ b/src/smf/agent/smfa_utils.c
@@ -615,8 +615,8 @@ SMFA_CBK_HDL_LIST *smfa_inv_hdl_add(SaInvocationT inv_id, 
SaSmfHandleT hdl)
}

/***************************************************************************
-@brief : Match the filter. If matches, post the evt to the client MBX
- and increment the cbk count of the the corresponding hdl node.
+@brief : Match the filter. If matches, increment the cbk count of
+ the corresponding hdl node and post the evt to the client MBX.
If for a client, more than one scope matches, then those many
no of evts are posted to the MBX.
@param[in] : client_info - For which filter match to be performed.
@@ -694,27 +694,31 @@ uint32_t smfa_cbk_filter_match(SMFA_CLIENT_INFO 
*client_info,
&cbk_evt->object_name),
&evt->evt.cbk_evt.object_name);

- if (m_NCS_IPC_SEND(&client_info->cbk_mbx,
- (NCSCONTEXT)evt,
- NCS_IPC_PRIORITY_NORMAL)) {
- /* Increment the cbk count.*/
- if (NULL != hdl_list) {
- /* There are two scope id
- * matching for the same hdl.*/
- } else {
- /* First scope id matching for
- * this hdl.*/
- hdl_list = smfa_inv_hdl_add(
- cbk_evt->inv_id,
- client_info->client_hdl);
- }
- hdl_list->cnt++;
- rc = NCSCC_RC_SUCCESS;
+ /* Increment the cbk count.*/
+ if (NULL != hdl_list) {
+ /* There are two scope id
+ * matching for the same hdl.*/
} else {
+ /* First scope id matching for
+ * this hdl.*/
+ hdl_list = smfa_inv_hdl_add(
+ cbk_evt->inv_id,
+ client_info->client_hdl);
+ }
+ hdl_list->cnt++;
+ rc = m_NCS_IPC_SEND(
+ &client_info->cbk_mbx,
+ (NCSCONTEXT)evt,
+ NCS_IPC_PRIORITY_NORMAL);
+ if (rc != NCSCC_RC_SUCCESS) {
LOG_ER(
"SMFA: Posting to MBX failed. hdl: %llu, scoe_id: %u",
client_info->client_hdl,
cbk_evt->scope_id);
+ /* Descrease the cbk count */
+ smfa_cbk_ok_resp_process(
+ client_info->client_hdl,
+ cbk_evt->inv_id);
}

/* If one of the filter matches then go to the
-- 
2.18.0

------------------------------------------------------------------------------
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

Reply via email to