Hi Nagu,

 

I think in this code block, it’s safe to acquire cb_lock.

Because it’s not interact with MDS like send msg through MDS during cb_lock 
taken.

I think the deadlock will not happen, I used to face this kind of deadlock in 
other services.

 

Since cb_lock is taken, then any Agent API will wait for cb_lock.

And SMF agent here mange itself SMF API calls, then I guess no problem about 
this.

 

Finally, the patch is already merged.

 

Best Regards,

Thuan

 

From: nagen...@hasolutions.in <nagen...@hasolutions.in> 
Sent: Thursday, July 12, 2018 11:09 AM
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: [devel] [PATCH 1/1] smf: use cb_lock to sync cbk count access 
between threads [#2882]

 

Hi Thuan,

 

Since MDS thread is RT and application thread can be non-RT, so I think there 
could be contention among the threads. We have no cases in the other services 
code where we have taken Lock in MDS thread. I also have experience of seeing 
deadlock of threads in such cases.

 

What do you think?

 

 

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: [devel] [PATCH 1/1] smf: use cb_lock to sync cbk count access between 
threads [#2882]
From: "thuan.tran" <thuan.t...@dektech.com.au 
<mailto:thuan.t...@dektech.com.au> >
Date: 7/11/18 12:18 pm
To: 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> 

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 ++++++-
1 file changed, 6 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) {
-- 
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 
<mailto: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

Reply via email to