Hi Nagu
The AMF agent library appears to do that. I guess extra care needs to be
taken to remove such "cb locks" before MDS API calls are made.
Gary
On 12/07/18 14:08, nagen...@hasolutions.in wrote:
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
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>
Date: 7/11/18 12:18 pm
To: nguyen.tk....@dektech.com.au, lennart.l...@ericsson.com,
gary....@dektech.com.au
Cc: 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
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