Ack from me.
The tile of the patch should start with "smf:" rather than "smd:".
Best Regards,
Thanh

-----Original Message-----
From: Thang Duc Nguyen <thang.d.ngu...@dektech.com.au> 
Sent: Monday, 18 January 2021 2:32 PM
To: Thanh Nguyen <thanh.ngu...@dektech.com.au>; Thien Minh Huynh 
<thien.m.hu...@dektech.com.au>
Cc: opensaf-devel@lists.sourceforge.net; Thang Duc Nguyen 
<thang.d.ngu...@dektech.com.au>
Subject: [PATCH 1/1] smd: avoid smf stucked during admin op in parallel [#3248]

There is rare case that thread adminOperationAsyncThread done before the main 
thread continue. It caused the main thread stucked forever.

The fix is to correct this issue.
---
 src/smf/smfd/SmfUtils.cc | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/smf/smfd/SmfUtils.cc b/src/smf/smfd/SmfUtils.cc index 
a7f0cf895..45da44256 100644
--- a/src/smf/smfd/SmfUtils.cc
+++ b/src/smf/smfd/SmfUtils.cc
@@ -269,7 +269,7 @@ bool SmfImmUtils::initialize(void) {
   }
 
   m_asyncThreadRunning = false;
-  m_admOiReturn = SA_AIS_OK;
+  m_admOiReturn = SA_AIS_ERR_TRY_AGAIN;
 
   return true;
 }
@@ -649,6 +649,7 @@ void SmfImmUtils::adminOperationAsyncThread(void) {  // 
------------------------------------------------------------------------------
 void SmfImmUtils::callAdminOperationAsync(
     const std::string &i_dn, SaAmfAdminOperationIdT i_operationId) {
+  TRACE_ENTER();
   if (m_asyncThreadRunning) {
     LOG_ER("Already invoke admin async with this instance");
     return;
@@ -662,7 +663,11 @@ void SmfImmUtils::callAdminOperationAsync(
     LOG_ER("Failed to create thread adminOperationAsyncThread");
     exit(EXIT_FAILURE);
   }
-  while (!m_asyncThreadRunning) { base::Sleep(base::kOneMillisecond); }
+
+  while (!m_asyncThreadRunning && (m_admOiReturn == SA_AIS_ERR_TRY_AGAIN)) {
+    base::Sleep(base::kOneMillisecond);
+  }
+  TRACE_LEAVE();
 }
 
 // 
------------------------------------------------------------------------------
--
2.25.1



_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to