Hi Thuan

Looks OK to me, but I would remove the assert. We shouldn't do that in library 
code.

Thanks
Gary

On 10/7/18, 6:52 pm, "thuan.tran" <thuan.t...@dektech.com.au> wrote:

    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, use cb_lock to sync cbk count acess between 
threads.
    ---
     src/smf/agent/smfa_mds.c   | 7 ++++++-
     src/smf/agent/smfa_utils.c | 1 +
     2 files changed, 7 insertions(+), 1 deletion(-)
    
    diff --git a/src/smf/agent/smfa_mds.c b/src/smf/agent/smfa_mds.c
    index 3d288b5eb..ededbaa55 100644
    --- a/src/smf/agent/smfa_mds.c
    +++ b/src/smf/agent/smfa_mds.c
    @@ -243,7 +243,11 @@ uint32_t smfa_mds_rcv_cbk(MDS_CALLBACK_RECEIVE_INFO 
*rcv_evt)
                return NCSCC_RC_SUCCESS;
        }
     
    -   /* TODO: I need to take READ LOCK here. But in MDS thread ???*/
    +   if (m_NCS_LOCK(&cb->cb_lock, NCS_LOCK_WRITE) != NCSCC_RC_SUCCESS) {
    +           LOG_ER("SMFA: Cb lock acquire FAILED.");
    +           TRACE_LEAVE();
    +           return NCSCC_RC_FAILURE;
    +   }
        client_info = cb->smfa_client_info_list;
        while (NULL != client_info) {
                /* If filter matches, post the evt to the corresponding MBX.*/
    @@ -252,6 +256,7 @@ uint32_t smfa_mds_rcv_cbk(MDS_CALLBACK_RECEIVE_INFO 
*rcv_evt)
                        filter_match = true;
                client_info = client_info->next_client;
        }
    +   m_NCS_UNLOCK(&cb->cb_lock, NCS_LOCK_WRITE);
     
        /* If filters dont match, respond to ND as SA_AIS_OK*/
        if (false == filter_match) {
    diff --git a/src/smf/agent/smfa_utils.c b/src/smf/agent/smfa_utils.c
    index fb31a9ae1..b250e9bc2 100644
    --- a/src/smf/agent/smfa_utils.c
    +++ b/src/smf/agent/smfa_utils.c
    @@ -715,6 +715,7 @@ uint32_t smfa_cbk_filter_match(SMFA_CLIENT_INFO 
*client_info,
                                            "SMFA: Posting to MBX failed. hdl: 
%llu, scoe_id: %u",
                                            client_info->client_hdl,
                                            cbk_evt->scope_id);
    +                                   osafassert(0);
                                }
     
                                /* 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