Hi Neel,

NACK with the patch.
Need to add 'retry > 0'  as part of while loop condition.

/Tai
-----Original Message-----
From: reddy.neelaka...@oracle.com [mailto:reddy.neelaka...@oracle.com] 
Sent: Wednesday, November 30, 2016 2:53 PM
To: lennart.l...@ericsson.com; rafael.odza...@ericsson.com;
tai.d...@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] smf: Avoid uncditional sleep when calling
adminoperation[#2211]

 osaf/services/saf/smfsv/smfd/SmfUtils.cc |  26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)


diff --git a/osaf/services/saf/smfsv/smfd/SmfUtils.cc
b/osaf/services/saf/smfsv/smfd/SmfUtils.cc
--- a/osaf/services/saf/smfsv/smfd/SmfUtils.cc
+++ b/osaf/services/saf/smfsv/smfd/SmfUtils.cc
@@ -583,19 +583,23 @@ SmfImmUtils::callAdminOperation(const st
        }
 
        /* Call the admin operation */
-       do {
-               TRACE("call immutil_saImmOmAdminOperationInvoke_2");
+       
+       TRACE("call immutil_saImmOmAdminOperationInvoke_2");
+       rc = immutil_saImmOmAdminOperationInvoke_2(m_ownerHandle,
&objectName, 0, i_operationId, i_params,
+                       &returnValue, i_timeout);
+       while ((rc == SA_AIS_OK) && (returnValue == SA_AIS_ERR_TRY_AGAIN)){
+               sleep(2);
                rc = immutil_saImmOmAdminOperationInvoke_2(m_ownerHandle,
&objectName, 0, i_operationId, i_params,
-                                                          &returnValue,
i_timeout);
-               if (retry <= 0) {
-                       LOG_NO("Fail to invoke admin operation, too many
SA_AIS_ERR_TRY_AGAIN, giving up. dn=[%s], opId=[%u]",
-                              i_dn.c_str(), i_operationId);
-                       rc = SA_AIS_ERR_TRY_AGAIN;
-                       goto done;
-               }
-               sleep(2);
+                               &returnValue, i_timeout);
                retry--;
-       } while ((rc == SA_AIS_OK) && (returnValue ==
SA_AIS_ERR_TRY_AGAIN));
+       } 
+       
+       if (retry <= 0) {
+               LOG_NO("Fail to invoke admin operation, too many
SA_AIS_ERR_TRY_AGAIN, giving up. dn=[%s], opId=[%u]",
+                               i_dn.c_str(), i_operationId);
+               rc = SA_AIS_ERR_TRY_AGAIN;
+               goto done;
+       }
 
        if ( rc != SA_AIS_OK) {
                LOG_NO("Fail to invoke admin operation, rc=%s. dn=[%s],
opId=[%u]",saf_error(rc), i_dn.c_str(), i_operationId);


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

Reply via email to